Prevent Ranorex Reporting Errors

Class library usage, coding and language questions.
SteveBeck
Posts: 19
Joined: Thu Jul 27, 2017 8:27 am

Prevent Ranorex Reporting Errors

Post by SteveBeck » Tue Aug 15, 2017 6:02 am

Hi, is there a way to prevent Ranorex from ending tests when it finds exceptions? As I would prefer to use my own system within Ranorex to report failures, the failure messages are too technical for the people who want to see the reports, and our own error messages let us know immediately on which line the test failed.

I tried setting the reporting level, but all that did was throw the Ranorex Exception ungracefully and leave a blank report.

Code: Select all


		if(!ApplicationUtility.setCheckboxState(repo.LogonForm.UseDomainAuthentication, true))
        	{
        		error = "set domain authentication failure.";
        		return false;
        	}
This is an example of what we want to do, inside that method we call a wait, but Ranorex is trying to create the adapter immediately. Is there some way we can reference the Repositories without it checking for the element?

SteveBeck
Posts: 19
Joined: Thu Jul 27, 2017 8:27 am

Re: Prevent Ranorex Reporting Errors

Post by SteveBeck » Tue Aug 15, 2017 7:00 am

I resolved this myself, but feel its useful to leave here.

Code: Select all

 if(!ApplicationUtility.setCheckboxState(repo.LogonForm.UseDomainAuthentication, true))
           {
              error = "set domain authentication failure.";
              return false;
           }
Uses an Adapter, Ranorex Assumes that the Adapter should exist at this point. For my uses I need to say

Code: Select all

 if(!ApplicationUtility.setCheckboxState(repo.LogonForm.UseDomainAuthenticationInfo, true))
           {
              error = "set domain authentication failure.";
              return false;
           }
And instead use the information about the adapter, that way I can control my exceptions.

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

Re: Prevent Ranorex Reporting Errors

Post by odklizec » Tue Aug 15, 2017 7:14 am

Hi,

Nice to hear you resolved your issue! I was just about to write you that you should use 'Info' object instead of adapter to detect the existence of an element and only if found, create an adapter from the Info object (if required) a do whatever you want to do with it.
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

SteveBeck
Posts: 19
Joined: Thu Jul 27, 2017 8:27 am

Re: Prevent Ranorex Reporting Errors

Post by SteveBeck » Tue Aug 15, 2017 7:53 am

I wish I'd done this from the start... A couple of thousand lines to code edit Hooray!

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

Re: Prevent Ranorex Reporting Errors

Post by odklizec » Tue Aug 15, 2017 8:07 am

Now this is exactly the reason, why you should not address the repo elements directly in code ;) If I were you, and since you are going through so many lines anyway, I would extend your methods with repoinfo parameters and replace all hardcoded references with parameters. Like this...

Code: Select all

public void MethodName(repoiteminfo elementName)
{
if(!ApplicationUtility.setCheckboxState(elementName, true))
           {
              error = "set domain authentication failure.";
              return false;
           }
...
Good luck with editing ;)
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