Page 1 of 1

data driven testing select dynamidally datasource

Posted: Mon Jan 30, 2017 1:15 pm
by pansujit
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

Re: data driven testing select dynamidally datasource

Posted: Thu Feb 02, 2017 2:31 pm
by qwertzu
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.

Re: data driven testing select dynamidally datasource

Posted: Fri Feb 03, 2017 4:14 pm
by pansujit
Hello,
Thank you qwertzu for your suggestion. I am going to use it and let you know the result.
Thanks a lot.

Sujit pandey

Re: data driven testing select dynamidally datasource

Posted: Fri Feb 24, 2017 12:04 pm
by pansujit
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

Re: data driven testing select dynamidally datasource

Posted: Fri Feb 24, 2017 12:26 pm
by odklizec
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