serenity-bdd / serenity-cucumber

Cucumber integration for the Serenity BDD Reporting library
Other
78 stars 74 forks source link

Add Tags to Example #169

Closed poorvikamahesh closed 5 years ago

poorvikamahesh commented 5 years ago

Hello,

I am trying to run a suite of scenarios with different sets of user data. The user data I am providing via examples have different roles. Therefor I want the same set if test cases to run for different user logins by providing tags to each of the Example entry. For example

Scenario: Login Module

Given I am on the application When I login with username: "/" and password: "/" Then the home page is displayed

@admin Examples: | userid | password | | admin | XXXXXXX|

@customer Examples: | userid | password | | cust1 | XXXXXXX|

I am not able to achieve this via the above syntax. Kindly help

Thank you!

wakaleo commented 5 years ago

This is a Cucumber-JVM question, not a Serenity one, but I believe the above syntax should work. What behaviour are you seeing?

poorvikamahesh commented 5 years ago

@wakaleo it runs all sets of data

My code is as below

@RunWith(CucumberWithSerenity.class) @WithTags({@WithTag("admin")}) @CucumberOptions(features = { "src/test/resources/Features/dummy.feature" }, glue = { "com.app.steps" }) public class FeatureRunner { }

I know this was working for another project in which Cucumber was integrated, not serenity cucumber

wakaleo commented 5 years ago

@WithTag is for JUnit tests, try using the CucumberOptiona tag attribute instead

poorvikamahesh commented 5 years ago

@wakaleo That worked... thanks a lot