GraphQL functional testing
Magento provides API functional tests that can verify extension points in GraphQL. These tests serve as an example for exposing new queries via GraphQL.
Creating a new GraphQL functional test
All GraphQL functional tests should inherit from the generic test case
Magento\TestFramework\TestCase\GraphQlAbstract. It defines the
graphQlQuery() method, which should be used to perform Web API calls from tests.
The following test verifies that the schema returns the correct attribute type, given the
attribute_code and corresponding
Using the default GraphQlQueryTest
\Magento\GraphQl\TestModule\GraphQlQueryTest.php test case uses two test modules to determine whether the mechanisms for GraphQL extensibility work as expected. It illustrates best practices for extending an existing GraphQL endpoint.
TestModuleGraphQlQuery- This bare-bones module defines a
testItemendpoint with the queryable attributes
name. It’s located at
TestModuleGraphQlQueryExtension- This module extends
TestModuleGraphQlQuery, adding the
integer_listextension attribute. It’s located at