Testing GraphiQL Query
Learn how to test GraphQL queries.
We'll cover the following
GraphQL query testing
GraphiQL is a great tool to explore our API and to run a query manually. However, it’s not a replacement for a test suite. We’ll use ExUnit to add tests for our Absinthe schema to ensure our queries work, both now and later, to prevent regressions.
ExUnit
ExUnit is bundled with Elixir, so no dependencies are required. Since our PlateSlate application uses Phoenix, ExUnit has already been set up with a preconfigured test harness that we can use.
We know our users are going to use the API by hitting /api
. Because of this, we can treat our API just as we would a Phoenix controller, using the PlateSlate.ConnCase
helper module that Phoenix generously generates for us.
Get hands-on with 1200+ tech skills courses.