I'm just wondering how under certain conditions I can handle Ranorex exceptions in different ways depending on the scenario.
For example....
It actually might be ok that a certain element was not found and in this case I want to flag up a warning rather than fail the test.
My tests are executed via nunit and I was wondering about using Assert.Inconclusive or Assert.Ignore in the exception handler.
However in other cases I would want the case to fail so I would need a different handler.
Apologies my exception handling knowledge is novice at best.
Is there a better way to to this.... I'm guessing there might be.
Using Assert.Inconclusive with Ranorex??
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Using Assert.Inconclusive with Ranorex??
Hi brgibb,
You can try to embed the specific line of code into a "try catch" block.
Bernhard
You can try to embed the specific line of code into a "try catch" block.
try { repo.YourItem.Self.Click(); Delay.Milliseconds(200); } catch(Exception ex) { Report.Log(ReportLevel.Warn, "Could not click item!"); }Regards,
Bernhard
Re: Using Assert.Inconclusive with Ranorex??
Thanks for your reply.
this would throw a Ranorex warning but can you help me further....how would I then pass this back to a nUnit test so that the nUnit console shows the test in yellow rather than green or red?
this would throw a Ranorex warning but can you help me further....how would I then pass this back to a nUnit test so that the nUnit console shows the test in yellow rather than green or red?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Using Assert.Inconclusive with Ranorex??
Hi brgibb,
Unfortunately I am not exactly sure what you mean. Can you please describe the issue in more detail?
Regards,
Bernhard
Unfortunately I am not exactly sure what you mean. Can you please describe the issue in more detail?
Regards,
Bernhard
Re: Using Assert.Inconclusive with Ranorex??
Hi,
Essentially how do I get get nUnit to report an inconclusive result (i.e. yellow) rather than a pass or a fail when Ranorex throws a report.info "warning".
All of my Ranorex functionality is called from an nUnit test with a try / catch round the call and I would like the nUnit results to show that there has been a warning found ...not just Ranorex.
If I understood you first reply correctly you were suggesting I put a try / catch round the attempt to find an element.This is fine as Ranorex will report a warning in the Ranorex report via the catch but it would not pass this warning result back to the calling nUnit test.....it presumably would simply pass would it not?
Does this make sense?
Essentially how do I get get nUnit to report an inconclusive result (i.e. yellow) rather than a pass or a fail when Ranorex throws a report.info "warning".
All of my Ranorex functionality is called from an nUnit test with a try / catch round the call and I would like the nUnit results to show that there has been a warning found ...not just Ranorex.
If I understood you first reply correctly you were suggesting I put a try / catch round the attempt to find an element.This is fine as Ranorex will report a warning in the Ranorex report via the catch but it would not pass this warning result back to the calling nUnit test.....it presumably would simply pass would it not?
Does this make sense?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Using Assert.Inconclusive with Ranorex??
Hello brgibb,
As I know it should work using the "Console.Error.Write()" method.
Regards,
Bernhard
As I know it should work using the "Console.Error.Write()" method.
Console.Error.Write("Your message", ConsoleColor.Yellow);I am afraid that I cannot provide deeper support concerning this problem because this is not an issue in Ranorex. Maybe other users in our forum have more experience with NUnit and can give you more information about that.
Regards,
Bernhard
Re: Using Assert.Inconclusive with Ranorex??
Hi brgibb,
in the example Bernard provided,in the catch under Report.Log, you can add Assert.Ignore("Your warning message here"). That will mark the nunit test in yellow
in the example Bernard provided,in the catch under Report.Log, you can add Assert.Ignore("Your warning message here"). That will mark the nunit test in yellow
Support Team wrote:try { repo.YourItem.Self.Click(); Delay.Milliseconds(200); } catch(Exception ex) { Report.Log(ReportLevel.Warn, "Could not click item!"); }