graphQL API 的性能测试 [英] Performance test for graphQL API

查看:35
本文介绍了graphQL API 的性能测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,当服务器是 REST API 时,我正在使用 Jmeter 进行 API 自动化测试和性能测试.

现在开发改成graphQL API,我有两个问题:

  1. 执行自动化 API 和性能测试的最佳方法是什么?
  2. Jmeter 是否支持 graphQL API?

解决方案

我使用

2.设置 HTTP 标头

根据您的应用程序,您可能还需要为 JWT Web 令牌设置 HTTP 标头授权,例如:

Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxx

3.如果您的应用需要,请设置 HTTP Cookie

4.运行测试

Today I'm doing my API automation testing and performance testing with Jmeter when the server is a REST API.

Now the development changed to graphQL API, and I have two questions about it:

  1. What is the best way to perform the automation API and performance testing?
  2. Does Jmeter support graphQL API?

解决方案

I use Apollo to build the GraphQL server, and use JMeter to query the GraphQL API as below.

1. Set up HTTP Request

2. Set up HTTP Headers

Depending on your application, you might also need to set up HTTP header Authorization for JWT web tokens, such as:

Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxx

3. Set up HTTP Cookie if needed for your app

4. Run the test

这篇关于graphQL API 的性能测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆