-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle exceptions in emailable Reporter
Closes #3038
- Loading branch information
1 parent
95328f4
commit f5a46d5
Showing
7 changed files
with
97 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
testng-core/src/test/java/test/reports/issue3038/AnotherTestCaseSample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package test.reports.issue3038; | ||
|
||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
public class AnotherTestCaseSample { | ||
|
||
@BeforeMethod | ||
public void beforeMethod() {} | ||
|
||
@Test | ||
public void testHello() {} | ||
} |
22 changes: 22 additions & 0 deletions
22
testng-core/src/test/java/test/reports/issue3038/ExceptionAwareEmailableReporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package test.reports.issue3038; | ||
|
||
import java.util.List; | ||
import org.testng.ISuite; | ||
import org.testng.reporters.EmailableReporter2; | ||
import org.testng.xml.XmlSuite; | ||
|
||
public class ExceptionAwareEmailableReporter extends EmailableReporter2 { | ||
|
||
public boolean hasError = false; | ||
|
||
@Override | ||
public void generateReport( | ||
List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) { | ||
try { | ||
super.generateReport(xmlSuites, suites, outputDirectory); | ||
} catch (IllegalStateException e) { | ||
hasError = true; | ||
throw e; | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
testng-core/src/test/java/test/reports/issue3038/TestCaseSample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package test.reports.issue3038; | ||
|
||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
public class TestCaseSample { | ||
|
||
@BeforeMethod | ||
public void beforeMethod() {} | ||
|
||
@Test | ||
public void testHello() {} | ||
} |
15 changes: 15 additions & 0 deletions
15
testng-core/src/test/java/test/reports/issue3038/TestCaseWithConfigProblemSample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package test.reports.issue3038; | ||
|
||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
public class TestCaseWithConfigProblemSample { | ||
|
||
@BeforeMethod | ||
public void beforeMethod() { | ||
throw new RuntimeException("simulating a failure"); | ||
} | ||
|
||
@Test | ||
public void testHello() {} | ||
} |