Ask a Question

Referencing a Unique ID from one test into another

Occasional Contributor

Referencing a Unique ID from one test into another

I have a Keyword test in desktop application which generates an Order ID and I need to reference this Order ID in another test.

When I spy the result, this is what it looks like :



and 'SG1792246' is the Order ID I need to reference in another test.


Please help resolve the issue. I tried 'Set Variable value' but unable to split just the Order ID.


Frequent Contributor

You can still use Set Variable Value, but set the Mode to Code Expression. You'll have to come up with a code expression to split the string.

Split it around the "." character, then grab the last element, split it around underscores and grab the first element. That's your sales ID

You could also grab it from earlier in the string with a different split.


You'll also have to make sure to use a project variable so its value doesn't get lost (I am not sure if variables on other keyword tests go out of scope)

Senior SQA Automation Engineer
Occasional Contributor

Thank you for your inputs. I am halfway through and successfully able to split the data as needed and captured the order id.

However, I am missing how to call this function at the step level wherever the OrderID need to be called.

Could you please advise what should be the 'Operation' and the 'Value' at the step level?

Showing results for 
Search instead for 
Did you mean: