Page 1 of 1

Refresh Data source for test iteration

Posted: Wed Oct 30, 2019 4:56 pm
by _adrian_
Hi,
I have a test case that i connected a CVS data source to have few iteration with different values of few parameters.
After I update the database rows from a User Code module functions that write new data,
seems i can not refresh the Data source so, :wink: when it runs it reflects the new changes.

User Code module is added in the SETUP block of the test case.

Code: Select all

DataSources.Get(db).Load();

Re: Refresh Data source for test iteration

Posted: Thu Oct 31, 2019 1:55 pm
by McTurtle
Hi _adrian_,

I think its more like this:
var tc = (TestCase) TestSuite.Current.GetTestCase("TestCase");  
tc.DataContext.Source.Load();  
Where TestCase is the name of the test case for which you want to reload the connector. It is important that the code runs before TC is started.

Does it work?

Regards,
McTurtle

Re: Refresh Data source for test iteration

Posted: Thu Oct 31, 2019 3:51 pm
by _adrian_
I am using version 9.2 - that is giving error as

Code: Select all

Error	CS0246	The type or namespace name 'TestCase' could not be found 

Re: Refresh Data source for test iteration

Posted: Mon Nov 04, 2019 3:24 pm
by odklizec
Hi,

The code should look like this:

Code: Select all

var TC = (TestCaseNode)TestSuite.Current.GetTestContainer("TestCaseName"); 
TC.DataContext.Source.Load();
The one provided by McTurtle is correct, but only for older Ranorex versions (7.0 and older).