Page 1 of 1

Can i save data when test case finishs. V3.2.2

Posted: Fri Mar 23, 2012 8:02 am
by marcushe
In V3.xx you have introduced data-driven mechanism . However ,i don't know whether i can update a simple data table and then save it . Next time this case is invoked again ,i want to use the stored data.
For instance,
1. In a test case , i created a simple data table with a row of data and a parameter "ABC" in databinding.

2. In run , i update the data and created a new parameter "BCD" by TestCase.Current.DataContext.SetParame("BCD","000");

3. I tried TestCase.Current.DataContext.Source.Store();
When the test case finished , On data binding, i found the updated data and the new parameter are not saved into test case.

If i can update/save , it will much simplify my work

Re: Can i save data when test case finishs. V3.2.2

Posted: Fri Mar 23, 2012 9:58 am
by Support Team
Hi,
marcushe wrote:When the test case finished , On data binding, i found the updated data and the new parameter are not saved into test case.
Do you want to store the new parameter directly into your test case (Test Suite file) or do you want to use the param just at runtime?

Regards,
Peter
Ranorex Team

Re: Can i save data when test case finishs. V3.2.2

Posted: Mon Mar 26, 2012 3:06 am
by marcushe
Support Team wrote:Hi,
marcushe wrote:When the test case finished , On data binding, i found the updated data and the new parameter are not saved into test case.
Do you want to store the new parameter directly into your test case (Test Suite file) or do you want to use the param just at runtime?

Regards,
Peter
Ranorex Team
I want to store the data into my test case(file) . Then after Windows restart ,i can continue from the break-point.
And Any new params created at runtime could be saved .

Re: Can i save data when test case finishs. V3.2.2

Posted: Mon Mar 26, 2012 11:44 am
by Support Team
Hi,

Please try the following code to save it back to the test suite file.
TestCase.Current.DataContext.SetParameter("yourParamName","yourValue");
var testSuite = TestSuite.Current as TestSuite;        	
testSuite.FileName = testSuite.Name + ".rxtst";
testSuite.SaveToFile(null, false);
Regards,
Peter
Ranorex Team

Re: Can i save data when test case finishs. V3.2.2

Posted: Tue Mar 27, 2012 3:40 am
by marcushe
Support Team wrote:Hi,

Please try the following code to save it back to the test suite file.
TestCase.Current.DataContext.SetParameter("yourParamName","yourValue");
var testSuite = TestSuite.Current as TestSuite;        	
testSuite.FileName = testSuite.Name + ".rxtst";
testSuite.SaveToFile(null, false);
Regards,
Peter
Ranorex Team
Hi,Peter
It works.
BTW,
However , i think you didn't mention that a copy .rxtst will be created at YourProject\debug\bin\ , as well as other data source file(like .csv).
At first i run at Studio , at the end i found the params were not updated in the *.rxtst in my Studio . It almost make me think you give a wrong example. Then at bin\, i found the params had been updated in the
.rxtst here.

Re: Can i save data when test case finishs. V3.2.2

Posted: Tue Mar 27, 2012 8:22 am
by Support Team
Hi,

I thought you need the bin directory rxtst, otherwise you have just to replace the correct path to your filename then this should work too.

Regards,
Peter
Ranorex Team