GraphQL Performance Testing With Apache JMeter

Mohamed Tarek
3 min readAug 3, 2022

GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.

GraphQL queries access not just the properties of one resource but also smoothly follow references between them.

Although GraphQL is still an API request from a point of view , but in JMeter it has a different Sampler.

In this quick guide we’re going to use one of the demo endpoints which is :
https://github.com/graphql/swapi-graphql

Let’s get started 👇

  1. Open Apache JMeter
  2. Right-click on “Test Plan” and add a “Thread Group”
  3. Right-click on “Thread Group” , “Add” , “Sampler” , then select “GraphQL HTTP Request”
  4. Our target url is https://swapi-graphql.netlify.app/.netlify/functions/index
  5. Let’s configure the “GraphQL HTTP Request” as the following screenshot.

6. We’re are going to use the following query :

query AllPlanets { allPlanets { planets { climates } } }

7. One more thing is still missing , till now we don’t have request headers. Thats why we have to add “Http Header Manager” , as the following screen shot.

8. “content-type : application/json” is the header that will be added as the following screen shot.

9. Now we are ready to run , let’s add “View Results Tree” to check the response data.

That’s for today 🙂 , hope you find it useful.

Please share your tips, experience, comments, and questions for further enriching this topic of discussion.

Originally published at http://thetesttherapist.com on August 3, 2022.

--

--

Mohamed Tarek

Performance Test Engineer | Speaker | Blogger | HP Load Runner Certified | ISTQB Performance Testing Certified | Author of The Performance Testing Handbook