Forum Discussion

CamillaR's avatar
CamillaR
Occasional Contributor
4 months ago

Get test step property dynamically, without using the teststep name

Hi,

I have a test step called TestStepName with a property land, which is used in the request's json. I have used the Get Data functionality to point out the property. This works fine. I have to multiply this request a lot of times, one request for each country. That's why I have the country code in the land property, so it would be easy to change it. 

Now the problem: When I clone the test step, the new test step's name is TestStepName2. But in the json part the reference is still "${TestStepName#land}", so it takes the property value from the original test step. How can I write this in an other way so that the property from the actual test step is used? I don't want to update all references manually, there must be a way to make the property reference dynamic.

I have tried to replace TestStepName with testRunner.runContext.currentStep.name but that doesn't work.

I have googled for hours but can't find a solution, so I hope someone here has a smart way to solve this.

Regards, 
Camilla

 

3 Replies

  • CamillaR's avatar
    CamillaR
    Occasional Contributor

    You are absolutely right! I've never used that before but looked into it and managed to create my test pretty easy.

    Thank you :)