Below are the concepts which we are going to see in this.
By using the ‘@’ symbol along with any string name we can add the tags in the feature file.
@tagname
We can add the tags to the Feature line or Scenario line according to our requirement in the feature file.
We can add multiple tags at the same time.
Example: 1. In the Below feature file we have created four scenarios and we have decorated with the tags such as @profile , @login , @logout , @pages , @feeds and @groups. 2. We have defined step definitions for those feature files in steps package.
SocialNetworkSite.feature
# This is a Feature file @webpage Feature: SocialNetwork Webpage Tests @profile @login @logout Scenario: Profile related cases Given Launch the profile page When Change profile pic Then Verify profile pic @feed @login Scenario: Feeds related cases Given Launch the feed page When publish the feed Then Verify feed @pages Scenario: Pages related cases Given Launch the page When update the page data Then Verify page @group @profile Scenario: Group related cases Given Launch the group When update the group details Then Verify group
Feeds.py
from behave import given, when, then @given("Launch the feed page") def methodOne(context): print("L1 - Launching the feed page") @when("publish the feed") def methodTwo(context): print("L2 - published the feed") @then("Verify feed") def methodSix(context): print("L3 - verified feed ")
Groups.py
from behave import given, when, then @given("Launch the group") def methodOne(context): print("L1 - Launching the group") @when("update the group details") def methodTwo(context): print("L2 - published the group") @then("Verify group") def methodSix(context): print("L3 - verified group ")
Pages.py
from behave import given, when, then @given("Launch the page") def methodOne(context): print("L1 - Launching the page") @when("update the page data") def methodTwo(context): print("L2 - updated the page") @then("Verify page") def methodSix(context): print("L3 - verified page")
Profile.py
from behave import given, when, then @given("Launch the profile page") def methodOne(context): print("L1 - Launching the feed page") @when("Change profile pic") def methodTwo(context): print("L2 - published the feed") @then("Verify profile pic") def methodSix(context): print("L3 - verified feed ")