How do I use one variable in multiple places (beginner)?

Best practices, code snippets for common functionality, examples, and guidelines.
lschneider
Posts: 2
Joined: Mon May 18, 2020 8:22 pm

How do I use one variable in multiple places (beginner)?

Post by lschneider » Tue May 19, 2020 1:04 pm

I just started using Ranorex. I have a project that has multiple recording modules. I'd like to test the entry of a field. That field is used in multiple places (entered, searchable, editable) and is across multiple recording modules. I have to bind the parameter multiple times to different module variables and it seems strange. If I mistype, the tests will fail. Is there any way to create a parameter and bind it to multiple variables?

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

Re: How do I use one variable in multiple places (beginner)?

Post by odklizec » Tue May 19, 2020 1:27 pm

Hi,

As long as the variable name and parameter name is the same (including character case), you can use "auto-bind" feature, which helps with bindig parameters/data connectors to multiple variables.

Another way is to split your recordings into smaller modules and use single recording just for filling given input, which, as I understand, is always the same? Then simply reuse this module in your test structure, instead of adding the same element to each affected recording.
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

lschneider
Posts: 2
Joined: Mon May 18, 2020 8:22 pm

Re: How do I use one variable in multiple places (beginner)?

Post by lschneider » Wed May 20, 2020 5:23 pm

Thank you. I was asking about making sure that if I enter x in a field, I can then search for x and verify that something exists called x. I don't want data entry to be a reusable module, I want the value x to be used in multiple places. But you gave me a lot to look into and I found that what I needed was a simple table datasource which I can bind a value to multiple variables.