data driven testing select dynamidally datasource

Ask general questions here.
pansujit
Posts: 18
Joined: Mon Apr 18, 2016 2:56 pm

data driven testing select dynamidally datasource

Post by pansujit » Mon Jan 30, 2017 1:15 pm

Hello,
I have create a scenario for which I need to select one data from test suite label and accordingly select the files inside it. for example:

testsuite
testcase ------------dataconn1 which (contains "abc","def" and "ijk" in each in each row)
testcase1--------dataconn2, dataconn3 and so on

"testcase1" is nested over "testcase". And testcase1 has the multiple data file which should attach to the testcase1 dynamically depeneds upon the data used in "testcase". If the data in "testcase" is "abc" then select the dataconn2 and "def" dataconn3 and so on.

As far as I know, It possible to select the data file dynamically for testcase is possible in ranorex but I don't know how to workaround.

Thanking you

Sujit Pandey

qwertzu
Posts: 178
Joined: Wed Jan 25, 2017 11:08 am

Re: data driven testing select dynamidally datasource

Post by qwertzu » Thu Feb 02, 2017 2:31 pm

Hi Pansujit,

Unfortunately it is not possible to add more than one data connector for each test case. But it is possible to create different data connectors and use them in your user code.

This would be a possible solution for you:

Getting access to the TestCase :

Code: Select all

var testCase1 = TestSuite.Current.GetTestCase("TestCase1");
Getting access to a data connector in your code:

Code: Select all

var testsource = DataSources.Get("dataconn1");
Assign Data Connector to the test case:

Code: Select all

testCase1.DataContext.Source=testsource;
Just use those lines in your condition inside "testcase" asking for the current value of the data connector (e.a. "abc")

I hope I could help you with your problem.

pansujit
Posts: 18
Joined: Mon Apr 18, 2016 2:56 pm

Re: data driven testing select dynamidally datasource

Post by pansujit » Fri Feb 03, 2017 4:14 pm

Hello,
Thank you qwertzu for your suggestion. I am going to use it and let you know the result.
Thanks a lot.

Sujit pandey

pansujit
Posts: 18
Joined: Mon Apr 18, 2016 2:56 pm

Re: data driven testing select dynamidally datasource

Post by pansujit » Fri Feb 24, 2017 12:04 pm

Hello, I have tried the above given example but due to my programming in efficiency, I cannot succeed the problem. The scenario, I have create as follow:

testcase1 ---------------------------- datasource "abc" ------ this contains 10 rows
nested testcase11--------------------------- 10 data source but run only one data source depending upon content of datasource "abc"("def", "ijk"and etc).
nested testcase 2-----------------------------10 data source but run only one data source at a time.

for example: In the testcase1, if there is a row "english cheese" then in testcase11 the "def" should run.
In the testcase1, if there is a row "French fromage" then in testcase11 the "ijk" should run.

I have tried to solve, but I am failed. If someone have any idea, please provide me some examples, if possible.

Thanking you
Sincerely
Sujit Pandey

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

Re: data driven testing select dynamidally datasource

Post by odklizec » Fri Feb 24, 2017 12:26 pm

Hi,

Check for example this post, where you can find a sample code describing how to set a nested data connector range, based of the value obtained from parent data connector...
http://www.ranorex.com/forum/looping-mo ... tml#p42114
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