Hello Everyone, Now We will go through the TAGS in cucumber. You can read the previous post related to how to write a Test Script in CUCUMBER : here
In chapter of Feature if we have many Scenarios , to put them under a single umbrella, we use tags in our cucumber through which we will be able to generate reports for specific scenarios under the same tag.
We can also provide multiple tags as values separated by commas as shown below .Tags are define in our runner class like this:
Let’s discuss about tag how it will work for cucumber. We can tag a scenario or a feature by putting an annotation as tag on the line before the Scenario keyword, like this:
Even, We can add multiple tags for same Scenario separated with spaces: like this:
If we want to combine all the scenarios in one feature, for this we have to tag the feature at the beginning of the feature then all the Scenarios will inherit the same tag.Along with this, we can still tag a single scenarios as well.
- By using tags, we can easily organize our feature and scenarios.
- Any string literal may be used as a tag in any scenario or entire feature.
- Feature can have multiple tags associated with it.
- Be aware that tags are heritable within Feature files.
- Different reports can be generated as per the requirements and the tags will be provided correspondingly.
In next tutorial we will get to know about Background…