Disable automatic code generation

Ranorex Spy, Recorder, and Studio.
tunc.simon
Posts: 2
Joined: Fri Nov 17, 2017 8:28 am
Location: Thalheim bei Wels, Austria
Contact:

Disable automatic code generation

Post by tunc.simon » Thu Jul 09, 2020 10:40 am

Hi,

I want to know how to disable automatic code generation in Ranorex Studio. For example, if I change or add something in a recording.cs (these files are read-only in Ranorex Studio) in Visual Studio and build the solution in Ranorex Studio, all changes will be undone.
How can I deactivate this? Because I have some changes to do some tasks asynchronously. That would be helpful.

Thanks!

BR,
Simon

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6237
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Disable automatic code generation

Post by odklizec » Thu Jul 09, 2020 11:01 am

Hi,

You must not change recording.cs files! These files are autogenerated by Ranorex (from recording.rxrec file) and must not be changed by the user! You should use Recording.UserCode.cs file to add your code to given recording.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

tunc.simon
Posts: 2
Joined: Fri Nov 17, 2017 8:28 am
Location: Thalheim bei Wels, Austria
Contact:

Re: Disable automatic code generation

Post by tunc.simon » Thu Jul 09, 2020 11:36 am

I know I shouldn't change it. But i still need it to run the tasks asynchronously.

More specifically: I have implemented a User Code Collection with several async tasks. Here I communicate with a machine. For this purpose, an in-house library has been developed that contains this async method, which I use from ranorex. When I call them up in recording.usercode.cs, the actual recordings remain empty.

Can someone explain to me why ranorex always generates the code new?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6237
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Disable automatic code generation

Post by odklizec » Thu Jul 09, 2020 12:03 pm

Hi,

Well, you can disable auto generation of code via this setting, but it will still auto-update recording.cs during build!
2020-07-09_12-53-47.png
2020-07-09_12-53-47.png (36.17 KiB) Viewed 129 times
Recording.cs files are updated, because recording alone is just a visual representation of test steps. It's cs file what's actually compiled, so any change in recording must be translated to cs file.

If you are implementing a custom code in Recording UserCode.cs, and you want the code to be used in Recording, you must add UserCode action to recording of your choice and link it with the user code method form UserCode.cs or any other class file!
UserCode.png
UserCode.png (60.41 KiB) Viewed 129 times
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration