Gherkin Scenario for Prism
PhilippeJousse opened this issue · comments
User Story Description
As a developer or tester,
I want to use prism mock with an order of request with specific response to follow.
so I can give a scenario file written with Gherkin syntax with each request which have Request path/Request verb/Response code/Response example/Response headers. Also I can choose to launch Prism with scenario mode ON or not with cli option
prism mock openapi.json -s users.feature
Example :
1st Request : GET on /users/10 -> Status 200 (OK)-> Give data
2nd Request : DELETE on /users/10 -> Status 201 (No content)
3rd Request : GET on /users/10 -> Status 404 (Not Found)
Example of Gherkin file :
Feature: Multiple /user endpoint test scenarios
Scenario: scenario_user10
Given path '/users/10'
And verb 'get'
Then code '200'
And header 'foo1: bar1'
And header 'foo2: bar2'
And body '{"name": "John Doe", "id": 10}'
Given path '/users/10'
And verb 'delete'
Then code '204'
Given path '/users/10'
And verb 'get'
Then code '404'
Hey @PhilippeJousse! 👋
I want to use prism mock with an order of request with specific response to follow.
This comes up from time to time and there's a roadmap item to +1 if you'd like, but we do not currently have plans to implement a persistence layer within Prism.
Hey, I misspoke about the user story. I'd like to publish a feature I've developed that allows you to provide a Gherkin file like the one in my first post that represents scenarios, i.e. a list of requests with their responses and then Prism will answer according to the scenario file. I will push a pull request in the coming weeks. I hope you will check it out with care. Thanks.
Ah, I see. Looking forward to seeing the PR :)