cliffapi
5 years agoOccasional Visitor
How to Set or Get "Test Step" Properties from another Test Case.
Hi. I am pulling my hair out. I have 2 test cases, the 1st one I created a "Properties" test step and I can set and get to that using Groovy within that test case.
I also have also created another "Properties" test step in the 2nd Test case and from within that Test Case (in Groovy) I want to Set a value in the 1st ones "Properties" test step, but cannot figure out how to do this. Any help would be appreciated, please. Thanks, Cliff.
This will work if both of your test cases are in the same test suite. If they are in different test suites then you will need to define what suite you are working with.
def tCase = testRunner.testCase.testSuite.getTestCaseByName("Global") def tStep = tCase.getTestStepByName("Global Properties") tStep.setPropertyValue("Property Name", "newValue")
If you wont need to reuse the test case or test step property then you can do it all in one line.
testRunner.testCase.testSuite.getTestCaseByName("Global").getTestStepByName("Global Properties").setPropertyValue("Property Name", "newValue")