Forum Discussion

Finan's avatar
Finan
Frequent Contributor
15 years ago

[RESOLVED]looping through testcases in a teardownscript

Hi,

I'm sorry if this has been documented or explained somewhere else, but I could not find the answer to the following question:
How do I loop through testcases in a teardown / setup script?

I have a testsuite with a bunch of testcases. Each testcase has a tesStep called "getInfo", with a propertyfield "info". After the testSuite finishes I want to clear the field "info" for all testcases.
So something like:
testSuite.getTestCaseByName("TC 1").getTestStepByName("getInfo").setPropertyValue("info","")
but instead of testSuite.getTestCaseByName("TC 1") I want to cycle through all the testcases.

Thx

Edit:

I've found the solution
for( testCase in testSuite.testCases )
{
testSuite.getTestCaseByName(testCase.key).getTestStepByName("getInfo").setPropertyValue("info","")
}
No RepliesBe the first to reply