Mark test suite as failed if condition in user code fails?

Class library usage, coding and language questions.
kmck
Certified Professional
Certified Professional
Posts: 83
Joined: Fri Jul 12, 2013 2:41 pm

Mark test suite as failed if condition in user code fails?

Post by kmck » Mon Aug 05, 2013 2:23 pm

I currently have a C# user code module that checks a document and creates a report if certain errors exist within the document. I was able to provide an error report for that particular user code, but the test suite still shows as passed.

How can I append my code to get the test suite to show as failed?

Thanks!

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Mark test suite as failed if condition in user code fails?

Post by krstcs » Mon Aug 05, 2013 2:36 pm

Have you tried...

Code: Select all

Report.Error(...);
Report.Log(ReportLevel.Error, ...);

Report.Failure(...);
Report.Log(ReportLevel.Failure, ...);
Shortcuts usually aren't...

kmck
Certified Professional
Certified Professional
Posts: 83
Joined: Fri Jul 12, 2013 2:41 pm

Re: Mark test suite as failed if condition in user code fails?

Post by kmck » Mon Aug 05, 2013 3:13 pm

Report.Failure worked perfectly. Thanks! :lol:

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Mark test suite as failed if condition in user code fails?

Post by krstcs » Mon Aug 05, 2013 3:29 pm

You're welcome!

Note that "Report.Error(...)" and "Report.Log(ReportLevel.Error, ...)" do the same thing. "Report.Error()" and all of the other methods like it (Info(), Pass(), etc.) are helpers for "Report.Log(ReportLevel.XXX, ...)".

Using "Report.Log()" allows you to pass a variable that will set the level.
Shortcuts usually aren't...