Forum Discussion

bk201's avatar
bk201
New Contributor
11 years ago

Manually Change TestCase

Hey,

As i understood this:
testRunner.testCase.getPropertyValue( "value" ).toInteger() 

testRunner.testCase always point to the "active" TestCase.

My Problem: I need access to a Property from an other TestCase with a groovy Scipt.
And i dont want to set the Property in the TestSuite.

Thank you for your Help.

(Please excuse my bad English)

greetings

1 Reply

  • Hello,
    You can use following groovy in your required test case:
    I have assumned the property you want to use is "value" and is stored in "Properties" test step of the test case.

    def project = context.testCase.testSuite.project
    def myTestSuite = project.getTestSuiteByName("Name of Suite")
    def myTestCase = myTestSuite.getTestCaseByName("Name of Test Case from which you want to pull some property")
    def myTestStep = myTestCase.getTestStepByName("Properties") // assumping name of test step
    def property_picked = myTestStep.getPropertyValue("value"); // assuming the property to be used
    log.info property_picked // can be used to play the way you wanna in your current Test case

    Hope it helps...