Test your GraphQL resolvers under pressure
GraphQL Load Testing
Send realistic GraphQL queries and mutations at scale. Identify slow resolvers, N+1 query problems, and connection pool exhaustion before they affect users.
Queries, mutations, and subscriptions
Variable parameterization
Authentication header injection
Per-operation latency tracking
Complexity-based testing scenarios
Works with Apollo, Hasura, and any GraphQL server
graphql-test.js
import http from 'k6/http';
import { check } from 'k6';
export const options = { vus: 50, duration: '3m' };
const query = `
query GetProducts($limit: Int!) {
products(limit: $limit) {
id
name
price
reviews { rating }
}
}
`;
export default function () {
const res = http.post('https://api.example.com/graphql',
JSON.stringify({ query, variables: { limit: 20 } }),
{ headers: { 'Content-Type': 'application/json' } }
);
check(res, {
'status 200': (r) => r.status === 200,
'no errors': (r) => !JSON.parse(r.body).errors,
});
}Frequently asked questions
Related guides
Run this as a plan
Put the scenario in your app's Config/load-plan.json and run it from the narduk-app CLI.