Module Groups and Variables

Best practices, code snippets for common functionality, examples, and guidelines.
HansSchl
Posts: 143
Joined: Wed Sep 19, 2018 10:05 am

Module Groups and Variables

Post by HansSchl » Tue Feb 22, 2022 8:28 am

Hi,

finally I found the time to try and create a module group. A situation which my tests face frequently is this sequence:
  • Select an entry in a table
  • Change the selected entry's name
I want to break this into two recordings, "Select.rxrec" and "Change.rxrec" (for reasons I don't want to discuss here). The Select recording has one variable "Row" which is the row number, and Change has another variable "Text" which is the new name.

Since these two recordings would frequently follow each other, I though I'd create a module group "Select_and_Change". But I found no way to supply values for the variables. All I get is the well-known "unbound variables" warning - and the test, of course, fails.

Can anyone help? Am I thinking along the wrong lines?

Thanks
Hans

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

Re: Module Groups and Variables

Post by odklizec » Tue Feb 22, 2022 8:53 am

Hi,

The problem with the module groups is , that you must create module group variables and connect these module group variables both with recording module variables and with Data connector of your choice.
GroupModuleVariables.png
Simply right click the Module Group, select Data Binding context menu item and in the appeared dialog either use AutoCreate button or create the variables manually. Then connect them with module variables. Then go back to test suite view and bind the group module variables with data connector of your choice. That's it ;)
You do not have the required permissions to view the files attached to this post.
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

HansSchl
Posts: 143
Joined: Wed Sep 19, 2018 10:05 am

Re: Module Groups and Variables

Post by HansSchl » Tue Feb 22, 2022 8:57 am

Thanks, Pavel! Does that mean a module group can also have its private variables, invisible to the outside world? (That would open a completely new and interesting world :D )

Hans

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

Re: Module Groups and Variables

Post by odklizec » Tue Feb 22, 2022 10:19 am

Well, I'm not sure what you mean by "private variables, invisible to the outside world"? Group module variables will act like any other module variables. If not connected to the data connector, there will be displayed message about unbound variables ;)
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

User avatar
Stub
Posts: 515
Joined: Fri Jul 15, 2016 1:35 pm

Re: Module Groups and Variables

Post by Stub » Tue Feb 22, 2022 12:35 pm

How about constant values defined locally to the Module Group? These can be bound to variables eliminating the unbound variables warning.

HansSchl
Posts: 143
Joined: Wed Sep 19, 2018 10:05 am

Re: Module Groups and Variables

Post by HansSchl » Tue Feb 22, 2022 1:36 pm

How about constant values defined locally to the Module Group?
Just discovered that. I'm still playing with this stuff, but I think it will we very handy.

I wished I could create variables which deliberately have no outside binding, but that is another story!

HansSchl
Posts: 143
Joined: Wed Sep 19, 2018 10:05 am

Module Groups and Variables and Smart Folders

Post by HansSchl » Tue Feb 22, 2022 1:56 pm

Is it possible to use smart folders and conditional execution inside a module group? The only folder which I found is not smart and has no conditions.

Hans

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

Re: Module Groups and Variables

Post by odklizec » Tue Feb 22, 2022 2:11 pm

Sadly no. SFs are not applicable in group modules.
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