Hi,
we have twi kinds of test Environments:
1. with productive data (datafile1.xlsx, Default)
2. with synthetic data (datafile2.xlsx)
I want to use zwo different exel files as data sources. The structure will be identically, the only dfference is the data.
Is it possible to change in code the data source connector from datafile1.xlsx to datafile2.xlsx? Of course I could use two different connectors, but in this case I will lose the data binding from the first connector...
Best regards
benjamin
Change data source in code
Re: Change data source in code
No idea? 

- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Change data source in code
Hi bennylew,
Sorry for the late response.
Unfortunately you need to create two DataConnectors to switch the data, but instead of using the Test Case Properties you could use the following lines of code
Hope that helps.
Regards,
Markus (S)
Sorry for the late response.
Unfortunately you need to create two DataConnectors to switch the data, but instead of using the Test Case Properties you could use the following lines of code
var tc = (TestCase) TestSuite.Current.GetTestCase("TestCase"); var source = DataSources.Get("Data2"); tc.DataContext.Source=source; tc.DataContext.Source.Load();*Whereby "TestCase" = the name of your Testcase and "Data2" = name of the new Data Connector
Hope that helps.
Regards,
Markus (S)