One of the most important pillars of developing and maintaining an API project is having a functional test suite that ensures the quality of request responses. In addition to quality assurance, functional tests also help the developer a great deal by simulating a client that can assert expectations, letting the developer know when objectives have been met. While most APIs still use a REST-based architecture, GraphQL has emerged as a popular choice due to how well it pairs with creating a rich client app. GraphQL gives the app developer tremendous control to request only what data is needed and nothing more, as well as fewer requests per page.
When it comes to functional testing, patterns for REST-based endpoints have been well established, but less so for GraphQL. GraphQL requests are different from REST endpoints in a few ways. GraphQL shares one endpoint, differing only in the payload that is sent to this endpoint. Not only is the same endpoint used for all requests and mutations, but the same JSON argument as well.