GraphQL
Supported test-directives
Qapir supports GraphQL and enables you to test GraphQL APIs. The supported directives are:
expected_http_statusof typenumber- verifies that response has expected HTTP-statusgraphql_queryof typestring- lets you pass aqueryto your GraphQL-requestgraphql_variablesof typemap[string]any- lets you passvariablesto your GraphQL-requestgraphql_operation_nameof typestring- lets you pass anoperationNameto your GraphQL-requestgraphql_extensionsof typemap[string]any- lets you passextensionsto your GraphQL-requestmethodof typestring- an HTTP-method, one of[GET, POST]
QTL-directives
- Extracting a value by jsonpath from response-body. This example looks for field with jsonpath
$.path.to.attributeand saves its value as${var.attribute}
SELECT
$.path.to.attribute AS ${var.attribute}
FROM
${response.body};
- Extracting a header-value. This example looks for header with name
Custom-Headerand saves its value as${var.header}
SELECT
Custom-Header AS ${var.header}
FROM
${response.headers};
Examples
Please, check out related examples in the official GitHub repo: https://github.com/vrtxlabs/qapir/blob/main/.qapir/tests/graphql_test.yml