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

Ask general questions here.
marcushe
Posts: 112
Joined: Tue Apr 14, 2009 6:38 am

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

Post by marcushe » Fri Mar 23, 2012 8:02 am

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

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

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

Post by Support Team » Fri Mar 23, 2012 9:58 am

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

marcushe
Posts: 112
Joined: Tue Apr 14, 2009 6:38 am

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

Post by marcushe » Mon Mar 26, 2012 3:06 am

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 .

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

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

Post by Support Team » Mon Mar 26, 2012 11:44 am

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

marcushe
Posts: 112
Joined: Tue Apr 14, 2009 6:38 am

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

Post by marcushe » Tue Mar 27, 2012 3:40 am

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.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

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

Post by Support Team » Tue Mar 27, 2012 8:22 am

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