Delegate Merged Variable from UserCode to Recording Module

Class library usage, coding and language questions.
Lyuba Boerma
Posts: 20
Joined: Mon Apr 01, 2019 12:12 pm

Delegate Merged Variable from UserCode to Recording Module

Post by Lyuba Boerma » Thu Apr 25, 2019 10:45 am

Hi..I check User guide and other topics ..but still can not solve mu issue.
I have a test-case. Where in a begin i create a new variable in a user code via merge of two other variables .

Code: Select all

	 var varMergedUrl=varMainDomain+varLinkPath;
6.png
6.png (42.94 KiB) Viewed 67 times
1.png
1.png (21.23 KiB) Viewed 69 times
2.png
2.png (27.77 KiB) Viewed 69 times
They are all bound to same Data connector. In a data connector the value of varMergedUrl is empty

After merge this variable has a value and ranorex open a correct link .
But he didn't save this value to the end of test case


But when test run comes to last module "Delete created Items" , the value of varMergedUrl is empty. And test fails.
what is a way to keep this value to the end of a test case?
6.png
6.png (42.94 KiB) Viewed 67 times

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

Re: Delegate Merged Variable from UserCode to Recording Module

Post by odklizec » Thu Apr 25, 2019 11:10 am

Hi,

How I understand it, the problem is caused by the fact, that empty varMergedUrl is stored in data connector. This approach "resets" the varMergedUrl when accessed from individual modules. All you have to do is to remove this variable from data connector and create a new Parameter in AddSample&Series smart folder. Then connect varMergedUrl from navigate_to module, to corresponding SF parameter and do the same with varMergedUrl from Delete+Created_Samples module.

For more detailed explanation how to share variables between modules, check this blog post:
https://www.ranorex.com/blog/sharing-da ... o-another/
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

Lyuba Boerma
Posts: 20
Joined: Mon Apr 01, 2019 12:12 pm

Re: Delegate Merged Variable from UserCode to Recording Module

Post by Lyuba Boerma » Thu Apr 25, 2019 1:08 pm

Thank you very much!
using parameters solved it!

Do you have somewhere information about hierarchy of variables?
If i have for example same variable for Smart folder, test case and recording module.. but with different value. Which one will implement?

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

Re: Delegate Merged Variable from UserCode to Recording Module

Post by odklizec » Thu Apr 25, 2019 1:26 pm

Hi,

It depends to which of these parameters will be the module binded to? Generally speaking, AutoBind will always pick the the parameter/data connector column from nearest parent TestCase/SmartFolder. But you can, of course, bind it manually to whatever parameter you want.

For example, in case of structure like this...

Code: Select all

Test Suite <- global parameter: 'abc'
|_Test Case <- TC parameter: 'abc'
    |_Smart Folder <- SF parameter: 'abc'
        |_module <- module variable 'abc'
module variable 'abc' will be autobinded to SF parameter 'abc'
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