NUnit + Exception : General Questions

NUnit + Exception

Ask general questions here.

NUnit + Exception

Postby SanMan » Wed May 19, 2010 7:29 am

Hi,

When I am running testcases via NUnit, where should I add the
try{}
catch{Exception e}
Report.Screenshot();

so that I will receive the screenshot if something goes wrong in my testcase?

If I add it to this [test], NUnit will pass the test in case of failure.

p.s. Does anyone here know, how to use NUnit2Report to make readable reports from NUnit genereded Testresults.xml?
SanMan
 
Posts: 49
Joined: Tue Apr 13, 2010 10:59 am

Re: NUnit + Exception

Postby Support Team » Wed May 19, 2010 9:41 am

Hi!

SanMan wrote:so that I will receive the screenshot if something goes wrong in my testcase?

Just add a try-catch block over the code that can throw an exception (like you would do it in a normal Ranorex Console Application) and re-throw the exception at the end of the catch.
catch (YourException e)
{
  Report.Error(e.ToString());
  Report.Screenshot();
  error = -1;
  throw;
}

SanMan wrote:Does anyone here know, how to use NUnit2Report to make readable reports from NUnit genereded Testresults.xml?

Sorry we don't have experience with NUnit2Report.

Regards,
Peter
Ranorex Support Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to General Questions

Who is online

Users browsing this forum: No registered users and 2 guests