Forum Discussion

gurman's avatar
New Contributor
4 years ago

Get Tags associated Scenario Outline Examples programatically


Just like we can get the tags associated with a feature file inside a beforeFeature hook like "Feature.Tags.item(0)" or the tags linked with a scenario in a beforeScenario hook "Scenario.Tags.item(0)", Is it also possible to retrieve the tags associated with a Scenario Outline Example?


Let's say I have a feature file as shown below:

Feature: AppLogin

Scenario Outline: As a user, I should be able to login to XYZ application
When user launches the application
Then login screen should get displayed
When user enters "<username>"
And user enters "<password>"
And user clicks on login button
Then user should be able to see main screen

@admin @level1
|adm1    |paxxword|

@supervisor @level1
|sup1    |paxxword|

@manager @level2
|mgr1    |paxxword|

@employee @level2
|emp1    |paxxword|


Now, if I run the above scenario for Level1 users i.e. by using the tag @level1, how do I know If the current scenario is being executed for the admin or supervisor? Somehow, I need to retrieve the value of the 1st tag associated with the Examples. Maybe something like Example.tags.item(0) but such an object does not exist in testcomplete? Can any one please help?



2 Replies