cancel
Showing results for 
Search instead for 
Did you mean: 

Get Tags associated Scenario Outline Examples programatically

gurman
New Contributor

Get Tags associated Scenario Outline Examples programatically

Hi,

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:

@Login
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
Examples:
|username|password|
|adm1    |paxxword|

@supervisor @level1
Examples:
|username|password|
|sup1    |paxxword|

@manager @level2
Examples:
|username|password|
|mgr1    |paxxword|

@employee @level2
Examples:
|username|password|
|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?

 

 

Tags (2)
1 REPLY 1
vinniew
Staff

Re: Get Tags associated Scenario Outline Examples programatically

Hi @gurman 

 

Hope you are well. 

 

I am not well versed using tags in TC but I believe this can be done using command line operations. 

 

Multiple tags can be used to satisfy your requirement

 

Check out the tag expression section. 

 

https://support.smartbear.com/testcomplete/docs/working-with/automating/command-line-and-exit-codes/...

 

The fact that this is supported via command line would suggest there may be an easier way of specifying the tags on execution here  

 

Let me know if this helps 🙂 

 

KR 

 

Vinnie

 

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors