Keeping changes made on generated code

Ranorex Spy, Recorder, and Studio.
schachner
Posts: 3
Joined: Wed Jan 07, 2009 1:20 pm
Location: vienna

Keeping changes made on generated code

Post by schachner » Mon Jan 12, 2009 6:36 pm

I' ve recorded some actions and manually
modified the generated code. But my changes got lost when
I replayed the recording.
Is there a way to prevent my own own changes from being overwritten?

Btw: When is the code re-generated?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Tue Jan 13, 2009 8:51 am

Hi,

Ranorex Recorder or Ranorex Repository generated code files should not be changed manually. Currently you'll have to extract the code generated by Ranorex Recorder to your own code files if you want to extend it with user code. In future versions we're planning to provide a mechanism to extend recorded actions directly within the Recorder's action table.

The code is generated automatically every time you edit and save the recorded actions.

kind regards,

Christoph,
Ranorex Support Team

darkness
Posts: 7
Joined: Mon Dec 15, 2008 9:56 am

Post by darkness » Tue Jan 13, 2009 4:40 pm

Support Team wrote: The code is generated automatically every time you edit and save the recorded actions.
Unfortunately it is also regenerated when the project is opened after it had been closed which makes changing the code more or less useless. This makes it impossible to parameterize recorded tests and identification of controls.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Tue Jan 13, 2009 5:40 pm

We are currently discussing about some recorder extensions, this will solve this problem, but the new feature will only come with V2.1.

You can do the following if you want to change and extend a recorder generated code.

1. Rightclick the project in the Project Explorer and select "Add New Item..."
2. Add a new C# class to the project
3. Open the source of the Recording project
4. Select and copy the code with Ctrl+A, Ctrl+C
5. Open the new generated C# class
6. Paste the code of the Recording project: Ctrl+A, Ctrl+V
7. Change the class name and extend the code
8. Call the static Start function of the new class in the Main function of the Project (Program.cs->Main)

You can convert a Recording project into a C# project manually this way.

Jenö
Ranorex Team