diff --git a/docs/testing/index.rst b/docs/testing/index.rst index 877879f6..db858b17 100644 --- a/docs/testing/index.rst +++ b/docs/testing/index.rst @@ -69,43 +69,3 @@ You can also add extra keyword arguments to the ``execute`` method, such as 'hey': 'hello Peter!' } } - - -Snapshot testing -~~~~~~~~~~~~~~~~ - -As our APIs evolve, we need to know when our changes introduce any breaking changes that might break -some of the clients of our GraphQL app. - -However, writing tests and replicating the same response we expect from our GraphQL application can be a -tedious and repetitive task, and sometimes it's easier to skip this process. - -Because of that, we recommend the usage of `SnapshotTest `_. - -SnapshotTest lets us write all these tests in a breeze, as it automatically creates the ``snapshots`` for us -the first time the test are executed. - - -Here is a simple example on how our tests will look if we use ``pytest``: - -.. code:: python - - def test_hey(snapshot): - client = Client(my_schema) - # This will create a snapshot dir and a snapshot file - # the first time the test is executed, with the response - # of the execution. - snapshot.assert_match(client.execute('''{ hey }''')) - - -If we are using ``unittest``: - -.. code:: python - - from snapshottest import TestCase - - class APITestCase(TestCase): - def test_api_me(self): - """Testing the API for /me""" - client = Client(my_schema) - self.assertMatchSnapshot(client.execute('''{ hey }'''))