Skip to content

Commit

Permalink
Do not fail if test failure has no exceptions
Browse files Browse the repository at this point in the history
refs #15890
  • Loading branch information
big-guy authored and ljacomet committed Jan 21, 2021
1 parent a9dc73a commit 31f14a8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Expand Up @@ -352,6 +352,10 @@ private TestCaseExecution skipped(long classId, long id) {

private Iterable<TestCaseExecution> failures(final long classId, final TestMethodResult methodResult, final FailureType failureType) {
List<TestFailure> failures = methodResult.getFailures();
if (failures.isEmpty()) {
// This can happen with a failing engine. For now we just ignore this.
return Collections.emptyList();
}
final TestFailure firstFailure = failures.get(0);
return Iterables.transform(failures, new Function<TestFailure, TestCaseExecution>() {
@Override
Expand Down
Expand Up @@ -181,6 +181,19 @@ class JUnitXmlResultWriterSpec extends Specification {
"""
}

def "can generate report with failed tests with no exception"() {
given:
TestClassResult result = new TestClassResult(1, "com.foo.FooTest", startTime)
result.add(new TestMethodResult(3, "some failing test", FAILURE, 10, startTime + 40))

when:
def xml = getXml(result)
then:
new JUnitTestClassExecutionResult(xml, "com.foo.FooTest", "com.foo.FooTest", TestResultOutputAssociation.WITH_SUITE)
.assertTestCount(1, 0, 1, 0)
.assertTestFailed("some failing test")
}

@Unroll
@Issue("gradle/gradle#11445")
def "writes #writtenName as class display name when #displayName is specified"() {
Expand Down

0 comments on commit 31f14a8

Please sign in to comment.