0

The application that I'm testing receives input from an outside sensor, but sensor data is unavailable on the test environment. Therefore, I use mock data. The problem is, mock data requires some more clicking to be done in the app.

So I would just add another step to my feature file when I'm testing on the test environment.

Is there a way to tag a single step the way you can tag a scenario in Cucumber?

1

Not directly the step, but the step can inspect the scenario context.

scenario.getSourceTagNames() would return the list of tags - thus you can add a @testEnv tag on the scenario and just perform the extra clicking if this tag is present.

With the configuration above, when in not in testing env, you can run all scenarios without @testEnv.

More details here and docs here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.