Hey,
We have an automation framework in place that can be configured to submit API requests against a downstream real application or a downstream simulator application. The BDD looks like the following
Given I configure my request
When I submit a request
Then I check the response is valid
The ‘Given I configure my request’ contains the logic for whether to submit requests vs a real app or simulator app based on parameter passed in when starting the tests.
The trouble is some of our negative tests can only be run against the simulator (e.g. application timeout) and therefore we want the BDD to look like the following:
Given I configure the simulator to respond with a timeout
And I configure my request
When I submit a request
Then I check the response is valid
The ‘Given I configure the simualtor to respond with a timeout’ step obviously doesn’t apply when running the tests vs the real application.
I can think of the following solutions to this problem:
- Create separate story/feature files for vs simulator and vs real application
- Encapsulate the logic for configuring the simulator in the ‘Given I configure my request’ step
- Use of meta-tags that tag each scenario as @simulator or @realApp and then run tests based on these conditions
- Keep the simulator configuration step but do no logic if its running vs the real Application
Can anyone offer any suggestions on the approach I should take?