Losing variable values when I call a recording

Ask general questions here.
djpflug23
Posts: 17
Joined: Fri Apr 15, 2011 9:13 pm

Losing variable values when I call a recording

Post by djpflug23 » Mon Apr 25, 2011 5:00 pm

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!

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

Re: Losing variable values when I call a recording

Post by Support Team » Tue Apr 26, 2011 12:59 pm

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

djpflug23
Posts: 17
Joined: Fri Apr 15, 2011 9:13 pm

Re: Losing variable values when I call a recording

Post by djpflug23 » Tue Apr 26, 2011 8:08 pm

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

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

Re: Losing variable values when I call a recording

Post by Support Team » Tue Apr 26, 2011 9:24 pm

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

djpflug23
Posts: 17
Joined: Fri Apr 15, 2011 9:13 pm

Re: Losing variable values when I call a recording

Post by djpflug23 » Tue Apr 26, 2011 10:00 pm

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!