datadriven test with SQL and variables

Ranorex Studio, Spy, Recorder, and Driver.
Posts: 3
Joined: Wed Jan 04, 2017 9:58 am

datadriven test with SQL and variables

Post by MiHa » Wed May 16, 2018 1:15 pm


I'd like to run testcases based on SQL-data, but the SQL queries are not static.

Here an example:
1. Start main testsuite which includes testcases for all possible product-parts
2. get the selected product from a dropdown and stored this value as "myproduct"
3. fire a MYSQL query to select all product-parts that assigned to the value of "myproduct"
4. start product-part testcase if the if its listed in the result of MYSQL query (by using the ranorex IF-condtions)

Posts: 297
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: datadriven test with SQL and variables

Post by McTurtle » Thu May 17, 2018 8:49 am

Hi MiHa,

The SQL datasource integration in Ranorex Studio unfortunately does not support dynamic querying. However, you can write your own code in C# for this and use it as a code module that would populate the variable myproduct: How to directly execute SQL query in C#?

After you have the variable populated in your code method, then you need to do the "if-listed" check in code and if successful, then you further bind the myproduct variable to a global parameter. The global parameter can then be used in the conditions of the Ranorex test suite: How to Create Conditions in Ranorex without Coding

I hope that this information helps you.