Page 1 of 1

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

Posted: Thu Apr 16, 2015 1:35 am
by c676228
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.

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

Posted: Thu Apr 16, 2015 5:24 am
by odklizec
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.

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

Posted: Fri Apr 17, 2015 1:13 am
by c676228
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

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

Posted: Fri Apr 17, 2015 5:39 am
by odklizec
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?

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

Posted: Mon Apr 20, 2015 11:40 am
by RobinHood42
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