Multiple Data Source in One Test Case or Use Ancestor's?

Ask general questions here.
c676228
Posts: 176
Joined: Mon Apr 06, 2015 5:40 am

Multiple Data Source in One Test Case or Use Ancestor's?

Post by c676228 » Thu Apr 16, 2015 1:35 am

Hi all,

It seems that a child test case can only see its own data source. it cannot see its parent or grandparent's data source. I created a variable in the child recording module. But I would like to do data bounding to its parent's data source, that seems not possible. If I want to add the parent's data source to this child, then the original/another data source I created in the child will be gone. So it seems that there won't be possible to have multiple data sources in one test case either. I guess I am doing something wrong. There must be a way to let variables in one test case/recording module to use multiple excel files, right?

The reason I am asking that is I want to have a global data source I can bound variables from any recording module.

Another thing is I don't know how to remove a global parameter after I created.

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

Re: Multiple Data Source in One Test Case or Use Ancestor's?

Post by odklizec » Thu Apr 16, 2015 5:24 am

Hi,

You should definitely be able to bind variables from child test cases/recordings with data sources from parent test cases. I'm using I all the time. What's the structure of your solution?

Let's say the structure looks like this...

Code: Select all

[TC1] data connector 1
|_recording-1
|_[TC2] data connector 2
    |_recording-2
    |_recording-3
You should be able to bind a variable from recording 2 or 3 with values from data connector 1.
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

c676228
Posts: 176
Joined: Mon Apr 06, 2015 5:40 am

Re: Multiple Data Source in One Test Case or Use Ancestor's?

Post by c676228 » Fri Apr 17, 2015 1:13 am

Hi Pavel,

You are right. I can bind variables within children test cases to their parent's data source.
But it seems that one test case only can have one data source.
:D

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

Re: Multiple Data Source in One Test Case or Use Ancestor's?

Post by odklizec » Fri Apr 17, 2015 5:39 am

Yep, one TC can have only one data connector. However, it should be possible to replace the data connector in runtime using some code? I never did that, but I'm sure it was discussed here in the past?
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
RobinHood42
Posts: 238
Joined: Fri Jan 09, 2015 3:24 pm

Re: Multiple Data Source in One Test Case or Use Ancestor's?

Post by RobinHood42 » Mon Apr 20, 2015 11:40 am

Hi guys,

You can set the data connector using the following code:
TestCase testcase = (TestCase) TestSuite.Current.GetTestCase("TestCase");

        	var source =  DataSources.Get("Connector");
        	testcase.DataContext.Source = source;
        	source.Load();
Hope this helps.

Cheers,
Robin