Ability to pass parameters directly #8
Labels
Component: Hooks
Extensibility and customization
Difficulty: Intermediate
Requires some experience
Type: Feature
New functionalities or enhancements
When testing some endpoint that implies having some id in the path or any other part:
/api/items/{item_id}
It will be helpful to put real
item_id
into parameters if it is known before the test:Under the hood, these parameters could be passed as
st.just
into the case strategy, be available in thecase
fixture.Goals:
just
is faster thanfrom_schema
(though in some cases it could be slower)Alternative - all parameters are named (kinda, since
requestBody
is a separate one), we can pass the something like this toparametrize
:In this case, the data generation is more flexible - we can generate whatever we need with Hypothesis strategies
Implementation notes:
st.composite
strategy that draws from the reduced schema first and then draws from the provided strategies.The text was updated successfully, but these errors were encountered: