SuperSingh
6 years agoContributor
Accessing Test Case Property in Project's TearDown script
Hi All,
I was looking for groovy script to access property from test cases in the TearDown script (of Project)
On doing GetData simply returns " context.expand( '${#TestCase#TCCount}' )" [TCCount is the name of property]
I have multiple testcases but GetData returns TestCase when I try to load using ReadyAPI feature.
That's probably a bug in ReadyAPI
I tried by providing testcase name in place of "TestCase" but it does not return anything.
Can someone please provide an answer incase they have used this.
Thanks !
What you have shown is the Teardown Script of Test suite, but not the project level Teardown.
/** * Below is the Teardown Script of the Test Suite * which looks for the given property in all the test cases of the same suite * and logs the value **/ //Specify your property name in below statement def propertyName = 'Property1' testSuite.testCaseList.each { kase -> if (kase.hasProperty(propertyName)) { log.info "${testSuite.name} suite, ${kase.name} case, ${propertyName} value is ${kase.getPropertyValue(propertyName)}" } }