2

I have recorded actions with Ranorex and I want to provide a reusable method. I have selected all actions and chosen the context menu entry "Merge items to user code item", which generated C# code for me.

Unfortunately the code is not clean, because it does not use a decorator pattern for the log statements. Every second line is a Report.Log() call. Aside of this architectural flaw, is there a way I could generate user code without those Report.Log() calls?

I have tried:

  • Tools/Options/General/Ranorex Code Generation, but there are no suitable options
  • Tools/Options/Coding/Code Generation, but there are no suitable options
  • Global Settings, but there are no suitable options
2

I'm astonished that Ranorex support told me that this is not possible, because here's how:

If you have not converted the recording into user code yet, you can change the settings like this:

  1. Open the recording in Ranorex Studio
  2. Click Settings...
  3. Go to tab "Current Recording"
  4. Uncheck "Use item logging by default"
  5. Click "Ok"
  6. Convert your recording to user code

Do not generate logging


Original answer, may still apply if you already have Report.Log() statements in your code.

Using the Search&Replace functionality (Ctrl+H) works fine when using a Regular Expression and replacing with nothing:

^[ \t]*Report.Log.*;\s*$

[ \t]* will allow tabs and spaces at the beginning (^), followed by a Report.Log call with any parameters (.*) until the end of the line ($) which may have trailing whitespace (\s*).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.