Page 1 of 1

Prevent Ranorex Reporting Errors

Posted: Tue Aug 15, 2017 6:02 am
by SteveBeck
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?

Re: Prevent Ranorex Reporting Errors

Posted: Tue Aug 15, 2017 7:00 am
by SteveBeck
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.

Re: Prevent Ranorex Reporting Errors

Posted: Tue Aug 15, 2017 7:14 am
by odklizec
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.

Re: Prevent Ranorex Reporting Errors

Posted: Tue Aug 15, 2017 7:53 am
by SteveBeck
I wish I'd done this from the start... A couple of thousand lines to code edit Hooray!

Re: Prevent Ranorex Reporting Errors

Posted: Tue Aug 15, 2017 8:07 am
by odklizec
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 ;)