01: package test.reports;
02:
03: import org.testng.Assert;
04: import org.testng.Reporter;
05: import org.testng.annotations.Test;
06:
07: /**
08: * Generates multiple permutations of TestNG output to see how things look in EmailableReporter.
09: *
10: * @author Paul Mendelson
11: * @since 5.3
12: * @version $Revision: 155 $
13: */
14: @Test
15: public class EmailableReportDriver {
16:
17: public void doFailureSansLog() {
18: Assert.fail("show failure in report");
19: }
20:
21: public void doFailureNested() {
22: Assert.fail("show failure in report", new Exception(
23: "Real cuase"));
24: }
25:
26: public void doFailureWithLog() {
27: Reporter.log("Preparing to fail");
28: Assert.fail("show failure in report");
29: }
30:
31: @Test(expectedExceptions={NumberFormatException.class})
32: public void doExpectedExceptionSansLog() {
33: Reporter.log("step 1");
34: Reporter.log("step 2");
35: Integer.parseInt("BAD TEXT");
36: }
37:
38: @Test(expectedExceptions={NumberFormatException.class})
39: public void doExpectedExceptionWithLog() {
40: Integer.parseInt("BAD TEXT");
41: }
42:
43: }
|