Using "Getvalue" for data set selection

Best practices, code snippets for common functionality, examples, and guidelines.
C_Schuh
Posts: 6
Joined: Thu Oct 29, 2020 12:04 pm

Using "Getvalue" for data set selection

Post by C_Schuh » Thu Oct 29, 2020 1:30 pm

Hello,

I am new here, I have chosen Ranorex 9.3.2 as the testing tool for our purposes, and first I want to say hello to everybody.

Im facing a problem and need your assistance.

There is an application to test with two different installions on two systems, two different stocks of data in the DB, and sometimes slightly different configurations. To maintain two different branches or solutions of tests for each installation could become confusing, I want to avoid this.

I had the following idea: During the test run it is identified on what system the test is executed. Then the proper test data is selected from the common testdata stock.

I am using the "Getvalue"-action to retrieve the host name and store it in a variable, "$Machine" (The retrived value is abbreviated by an RegEx). This works fine

I have added a column in the table of my test data "Machine", where the data sets have their proper entry like "Machine A" or "Machine B".

At the moment I cannot connect the variable with the data within the table column in a working way. Binding them in the properties window of the data source does presently not help.

I thought, it would be easiest to use a condition, defined in the conditions frame of the properties window of the data source:

"Data source - <table name> - Machine (column header) - is equal - $Machine (variable name)". The expression "$Machine" is directly typed in.

This ain't working, some other stuff I have also tried is not. I'm stuck. Maybe I can't see the forest for he trees.

Do you recommend a good practice to solve this?

I appreciate your support.

Best regards
Chris

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

Re: Using "Getvalue" for data set selection

Post by odklizec » Mon Nov 02, 2020 8:53 am

Hi,

If I understand your problem right, you simply want to obtain a value somewhere during the test, store it and use in later steps? This should be a relative easy process, described for example here:
https://www.ranorex.com/blog/sharing-da ... o-another/
Basically, you need to create a global/testcase/smartfolder parameter, which must be connected both to module obtaining the value (using Get Value action) and with any module where you want to use that value. Just follow the steps from above link.
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

C_Schuh
Posts: 6
Joined: Thu Oct 29, 2020 12:04 pm

Re: Using "Getvalue" for data set selection

Post by C_Schuh » Tue Nov 03, 2020 11:05 am

It goes a bit further:

I want the obtained value to be part of a condition. The condition, what data is used in that paticular test run. That's the part I'm stuck with. I do not adress it right.

thanx
Chris.

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

Re: Using "Getvalue" for data set selection

Post by odklizec » Tue Nov 03, 2020 11:19 am

Hi,

In this case, you need to create two (or more) SmartFodlers with different data connectors (or different data ranges) and each SmartFolder must have a condition, connected to parameter connected with module, where you call GetValue action. Of course, that module must be used "BEFORE" SmartFolders with condition.
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

C_Schuh
Posts: 6
Joined: Thu Oct 29, 2020 12:04 pm

Re: Using "Getvalue" for data set selection

Post by C_Schuh » Thu Nov 05, 2020 11:47 am

Thanks,

I will take this approach then.