Ask a Question

Property transfer into test step of run test case

SOLVED
BhuvanShanmugam
Contributor

Property transfer into test step of run test case

 

I have a test case (TCBase) that is (planned to be) called in many places.

This contains one operation and couple of property xfer steps.

 

I have a Run Test Case step in a higher level test case which call this TCBase.

I do have a requirement that each call may have to pass in a property into one of the test steps of the TCBase.

From the top level, I could only see the out parameter of the TCBase; none of the internal steps are visible.

 

Is there a way to get data into the TCBase test step?

 

Thanks

Bhuvan.

4 REPLIES 4
Radford
Super Contributor

If I understand you, you want to make a testCase reusable, passing in the appropriate parameters, I do something similar.

 

For each parameter you need in the "sub" test case create a test case level Custom Property. This custom property can be set by the "calling" test case (set via the RunTestCase test step) and can also be accessed within the "sub" test case. You can also use this method to create return parameters (just remember to mark the relevant custom properties as a return property in the calling RunTestCase test step).

 

Hope this helps.

Hi Radford,

 

The prop xfer doesnt seem to work. so i opened a support case and got it sorted using a groovy script;

but this is for passing values between RunTestCases.

However, What I want to achieve is to pass a property from the top level test case into the (sub) - RunTestCase->TestStep.

 

Here is a example of what I am trying to get - hope this helps with understanding.

 

Thanks

Bhuvan.

Hi Bhuvan,

Were you able to resolve the issue, I am having a similar problem? If you were able to resolve it, can you please post what you did ?

Hi,

 

I used groovy script to transfer properties into and out of a 'RunTestCase' - pass a line number into the test case.

 

e.g - Before calling OTSOnly - as a RunTestCase

def line = testRunner.testCase.testSuite.project.getProperty("normal_line").value;
log.info "Xfer line " + line.toString()
testRunner.testCase.testSuite.project.getTestSuiteByName("ReuseableCalls").getTestCaseByName("C1").setPropertyValue("inlinenum", line.toString())
log.info "Check line " + testRunner.testCase.testSuite.project.getTestSuiteByName("ReuseableCalls").getTestCaseByName("C1").getPropertyValue("inlinenum")

 

e.g - After calling - extract the session id from the response of the reusable test case and use it in next test step.

def sid = testRunner.testCase.getTestStepByName("Run TestCase - C1").getPropertyValue("outsessionid")
log.info "Xfer sid " + sid
testRunner.testCase.testSuite.project.getTestSuiteByName("ReuseableCalls").getTestCaseByName("C2").setPropertyValue("insessionid", sid.toString())
log.info "Check sid " + testRunner.testCase.testSuite.project.getTestSuiteByName("ReuseableCalls").getTestCaseByName("C2").getPropertyValue("insessionid")

cancel
Showing results for 
Search instead for 
Did you mean: