🎉 Quality of life improvements to Schemathesis stateful testing! Enjoy
🚀 Added
APIStateMachine.run
method to simplify running stateful tests.
🔧 Changed
- Improved quality of generated test sequences by updating state machines in Schemathesis to always run a minimum of two steps during testing. #1627
If you use hypothesis.stateful.run_state_machine_as_test
to run your stateful tests, please use the run
method on your state machine class instead. This change requires upgrading Hypothesis
to at least version 6.68.1
.
Example
import pytest
import schemathesis
@pytest.fixture
def state_machine():
schema = schemathesis.from_uri("https://example.schemathesis.io/openapi.json")
return schema.as_state_machine()
def test_statefully(state_machine):
state_machine.run()