Ask a Question

How to get Testcase Tag in a groovy script

New2API
Frequent Contributor

How to get Testcase Tag in a groovy script

Hi, I would like to get the tag name of a testcase in a groovy step.

 

intent:

def TagName = Get Current test's Tag

 

if(TagName == "Positive"){

                                                Do this

}else{

         do this

}

 

I used below scripts...

def ProjectTags = testRunner.testCase.testSuite.project.getTags()
log.info ProjectTags

def TC = testRunner.testCase.getTagIds()
log.info TC

 

Can you please provide some info one this?

TIA.

 

 

 

2 REPLIES 2
TanyaYatskovska
Community Manager

Re: How to get Testcase Tag in a groovy script

Hi,

 

Please refer to the product's API documentation to learn the property you can use for this:

https://www.soapui.org/apidocs/index.html?com/eviware/soapui/impl/wsdl/actions/support/package-summa...

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New2API
Frequent Contributor

Re: How to get Testcase Tag in a groovy script

Hi Tanya, Automation and scripting is relatively new for me. I did go through the API documentation, but couldn't find a method that would convert/present the Tag Ids in to Name.

 

As I mentioned earlier, I can extract tag names at project level. I would like to get test case tags at TestCase level to branch my test flow.

 

Thanks.

cancel
Showing results for 
Search instead for 
Did you mean: