Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gherkin Scenario for Prism #2390

Open
PhilippeJousse opened this issue Sep 21, 2023 · 3 comments
Open

Gherkin Scenario for Prism #2390

PhilippeJousse opened this issue Sep 21, 2023 · 3 comments

Comments

@PhilippeJousse
Copy link

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'
@ryotrellim
Copy link
Contributor

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.

@PhilippeJousse
Copy link
Author

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.

@ryotrellim
Copy link
Contributor

Ah, I see. Looking forward to seeing the PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants