About GraphQL and GraphQL Testing with Katalon

GraphQL is a query language specifically for API. It was initially developed by Facebook in 2012 and later released in 2015 as an open source. Around 2019, GraphQL was moved to the newly-established GraphQL Foundation.

Why GraphQL has been gaining popularity

Many business giants across industries have adopted GraphQL for their APIs due to certain advantages over the traditional RESTful APIs. Some names include Amazon AWS, Shopify, Twitter, Airbnb, Paypal, Gitlab, and GitHub. The list goes on.

Traditionally, with REST, data is located at different endpoints. In many cases, we need multiple data at a time. So, sending one request is simply not enough; or we can say it’s under-fetching since it does not respond with enough data. We usually need multiple round trips to get what we want.

Another drawback is that a REST API responds with a full data payload defined for the resource when it receives a request. But many times, we want only a small subset of data. This is over-fetching since it provides more data than we want.

Also, with REST APIs, the changes to be made at the front end need to be handled first by the back end. This usually results in delays in software development.

A GraphQL API, on the other hand, uses one single endpoint to get all the data that the front end needs in one request. GraphQL queries mirror the responses. You can specify the shape of the data for the request, and the response will be returned in the same shape. No more no less. Hence, no more under or over fetching.

Client-side describes what data fields they want, and server-side resolvers populate the data for the corresponding fields. It all happens in a syntax/schema that can work in any programming language.

The client-side can thereby process faster since they don’t need to wait for the server-side to deploy the new changes for the responses. The number of requests is also cut down since they can now get exactly what they want, improving the client-side performance.

Good read: Here’s why Facebook developed GraphQL

Good watch: GraphQL: The documentary (27 mins)

GraphQL Testing with Katalon

Katalon has developed and released new functionalities to meet the rising need for GraphQL testing. With Katalon Studio, users can now:

  • Create GraphQL test request for query and mutation with the GET and POST methods
  • Use query variables in a GraphQL request.
  • Validate GraphQL requests and responses against schemas.

If you already have experience with database query language, it should be relatively easy to pick up and use these functions effectively. To learn more about GraphQL and GraphQL testing with Katalon, you can visit:

Upcoming plans for GraphQL Testing

Katalon Studio begins to support GraphQL from the latest release 8.4.0. Although GraphQL offers great benefits for the client/user side, it’s still challenging for development team in terms of planning, implementation, and maintenance. So, we expect a quite-slow adoption of the new functionalities from users and more time to collect sufficient feedback.

The focus will be investigating the issues that our users encounter, like this one for GraphQL variables, and bug fixing. We also notice the response speed is not very optimal, quite slow, compared to other solutions. We’ll need to investigate this as well.

More enhancements and advanced functionalities will need to be added in the future. To do so, more learning and research are required. We’ll need to look into the technology, existing solutions on the market, and see how we can implement things in a way that fits into our platform. Workload and resource allocation are also things we’ll need to consider.

Special thanks to @Semileo - a developer in our Katalon team for sharing this topic. You can create an API project in Katalon Studio and try GraphQL testing now.

For more articles like this, visit our Product Insights corner.

Have a nice day!