graphQL API的性能测试 [英] Performance test for graphQL API
本文介绍了graphQL API的性能测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
今天,当服务器是REST API时,我将使用Jmeter进行API自动化测试和性能测试.
Today I'm doing my API automation testing and performance testing with Jmeter when the server is a REST API.
现在,开发已更改为graphQL API,对此我有两个问题:
Now the development changed to graphQL API, and I have two questions about it:
- 执行自动化API和性能测试的最佳方法是什么?
- Jmeter是否支持graphQL API?
推荐答案
免责声明:我为LoadImpact工作; k6背后的公司.
Disclaimer: I work for LoadImpact; the company behind k6.
如果您愿意考虑替代方法,我最近写了一篇有关该主题的博客文章:使用k6对GraphQL进行负载测试.
If you are willing to consider an alternative, I've recently written a blog post about this topic: Load testing GraphQL with k6.
这是k6示例的样子:
let accessToken = "YOUR_GITHUB_ACCESS_TOKEN";
let query = `
query FindFirstIssue {
repository(owner:"loadimpact", name:"k6") {
issues(first:1) {
edges {
node {
id
number
title
}
}
}
}
}`;
let headers = {
'Authorization': `Bearer ${accessToken}`,
"Content-Type": "application/json"
};
let res = http.post("https://api.github.com/graphql",
JSON.stringify({ query: query }),
{headers: headers}
);
这篇关于graphQL API的性能测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文