Using same recording multiple times in a test case

Best practices, code snippets for common functionality, examples, and guidelines.
theraviz
Posts: 43
Joined: Sun Apr 14, 2019 9:46 am

Using same recording multiple times in a test case

Post by theraviz » Mon Aug 26, 2019 1:18 pm

I have a reusable recording where it returns a value from a function and stores it in a variable (lets say _balance).

Now I want to use this recording 2 times in the same test case (because I want to check the value returned by this function before and after clicking submit). So I copy pasted the same recording 2 times in the same test case

Now the problem is that I can’t assign the return value to 2 different variables in each recording. Whenever I set the return value to a new variable in the first recording the same is reflecting in the second. So how to assign the value to a different variables in each recording.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5353
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Using same recording multiple times in a test case

Post by odklizec » Mon Aug 26, 2019 9:33 pm

Hi,

What you can do is to bind recording variable to different TestCase/SmartFolder parameters. And later use these two (or more) parameters for evaluation. Let’s the structure of your test looks like this...
[TestCase] ->param1, param2,..., paramN
|_RecModule1 - bind return variable with param1
|_RecModule2
|_RecModule3
|_RecModule1 - bind return variable with param2
|_CodeModule -> evaluate param1 & param2
Hope this helps?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

theraviz
Posts: 43
Joined: Sun Apr 14, 2019 9:46 am

Re: Using same recording multiple times in a test case

Post by theraviz » Tue Aug 27, 2019 8:07 am

Yes, I did the same already.

I have 2 variables (_retDbtAvBal1 and _retDbtAvBal2) for each recording. But in the first recording when the return value is assigned to _retDbtAvBal1

the same is reflecting in the second recording as well. and if i change the second recording return value the same is reflecting in the first as well.

That means all the time the variables assigned to get the return values are same in both the recordings.
Capture.JPG
Capture.JPG (42.47 KiB) Viewed 121 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5353
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Using same recording multiple times in a test case

Post by odklizec » Tue Aug 27, 2019 8:42 am

Hi,

You don’t need two recording module variables but two Test Case/Smart Folder parameters to which you bind recording module variable (which holds the return value). Now if you call the module for the first time, the return value will be stored in TC/SF parameter1. If you call the same module second time, it should store return value in TC/SF parameter2. So in the end, both return values are stored in different parameters, which you can process later in another module.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration