:version:`3.6.0 <v3.5.3...v3.6.0>` - 2021-04-04
-----------------------------------------------
**Added**
- Custom keyword arguments to ``schemathesis.graphql.from_url`` that are proxied to ``requests.post``.
- ``from_wsgi``, ``from_asgi``, ``from_path`` and ``from_file`` loaders for GraphQL apps. :issue:`1097`, :issue:`1100`
- Support for ``data_generation_methods`` and ``code_sample_style`` in all GraphQL loaders.
- Support for ``app`` & ``base_url`` arguments for the ``from_pytest_fixture`` runner.
- Initial support for GraphQL schemas in the Schemathesis runner.
.. code-block:: python
import schemathesis
Load schema
schema = schemathesis.graphql.from_url("http://127.0.0.1:8000/graphql")
Initialize runner
runner = schemathesis.runner.from_schema(schema)
Emit events
for event in runner.execute():
...
**Breaking**
- Loaders' signatures are unified. Most of the arguments became keyword-only. All except the first two for ASGI/WSGI, all except the first one for the others.
It forces loader calls to be more consistent.
.. code-block:: python
BEFORE
schema = schemathesis.from_uri(
"http://example.com/openapi.json", "http://127.0.0.1:8000/", "GET"
)
NOW
schema = schemathesis.from_uri(
"http://example.com/openapi.json", base_url="http://127.0.0.1:8000/", method="GET"
)
**Changed**
- Schemathesis generates separate tests for each field defined in the GraphQL ``Query`` type. It makes the testing process
unified for both Open API and GraphQL schemas.
- IDs for GraphQL tests use the corresponding ``Query`` field instead of HTTP method & path.
- Do not show overly verbose raw schemas in Hypothesis output for failed GraphQL tests.
- The ``schemathesis.graphql.from_url`` loader now uses the usual Schemathesis User-Agent.
- The Hypothesis database now uses separate entries for each API operation when executed via CLI. It increases its effectiveness when tests are re-run.
- Module ``schemathesis.loaders`` is moved to ``schemathesis.specs.openapi.loaders``.
- Show a more specific exception on incorrect usage of the ``from_path`` loader in the Schemathesis runner.
**Deprecated**
- ``schemathesis.runner.prepare`` will be removed in Schemathesis 4.0. Use ``schemathesis.runner.from_schema`` instead. With this change, the schema loading part
goes to your code, similar to using the regular Schemathesis Python API. It leads to a unified user experience where the starting point is API schema loading, which is
much clearer than passing a callback & keyword arguments to the ``prepare`` function.
**Fixed**
- Add the missing ``schema.given`` implementation for schemas created via the ``from_pytest_fixture`` loader. :issue:`1093`
- Silently ignoring some incorrect usages of ``schema.given``.
- Fixups examples were using the incorrect fixup name.
- Return type of ``make_case`` for GraphQL schemas.
- Missed ``operation_id`` argument in ``from_asgi`` loader.
**Removed**
- Undocumented way to install fixups via the ``fixups`` argument for ``schemathesis.runner.prepare`` is removed.