Page 1 of 1

Losing variable values when I call a recording

Posted: Mon Apr 25, 2011 5:00 pm
by djpflug23
Hi,

I have a quick question about a problem that I'm having. I have a test where I try to log in to our application, but if a couple specific services aren't started that fails, so the test then starts the services. I'm then calling the same recording to go through the steps again and to try to log in to the application. However, when it starts the recording over it seems to lose the data that I put in for my userID and password variables. Is this supposed to be happening? How can I get it to keep these values so that I can get this to work? Thanks!

Re: Losing variable values when I call a recording

Posted: Tue Apr 26, 2011 12:59 pm
by Support Team
Hi,

can you please describe "in detail" all steps you are performing.
Do you use variables from Ranorex Test Suite and start the recording not out of the Test Suite.
In that case the bindings will be lost and the default values of your variables will be taken.
So please give us more information about the steps you are performing.

Regards,
Tobias
Support Team

Re: Losing variable values when I call a recording

Posted: Tue Apr 26, 2011 8:08 pm
by djpflug23
I was using the test suite to create the variables, and stored them in a simple data table. I then ran the project through the test suite. However, the recording is then called again by itself within the code, and that is when the variables seem to get lost. Is this enough of a description? I'm not really sure what other information I can give... Thank you for your help!

Dave

Re: Losing variable values when I call a recording

Posted: Tue Apr 26, 2011 9:24 pm
by Support Team
Hello Dave,

a recording is a .NET class (C# or VB). A recording class has an instance member. Normally you use only this instance (e.g. through the Start() method). The variables of a recording are variables of the class. Every instance has its own set of variables, but if you use the same instance the same set of variables should be reused. The variables are filled with the table rows by the TestRunner using the information in rxtst file. Then the Run() of the recording class instance is called. If you call that again recursively from within Run() using a user code action, then the same variables should be used. But probably you do it somehow differently else you wouldn't have the problem. Nevertheless possibly the description helps you to rethink your case and find a solution.

Regards,
Roland
Ranorex Support Team

Re: Losing variable values when I call a recording

Posted: Tue Apr 26, 2011 10:00 pm
by djpflug23
Thanks, Roland, for explaining that to me. I was able to figure it out. I needed to call the method that I was in rather than the whole recording, and it worked fine that way. Thank you for your timely responses!