Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ We use [semantic versioning](http://semver.org/):
- [fix] _teamscale-gradle-plugin_, _teamscale-maven-plugin_: Testwise coverage reports no longer drop a class directory that contains an archive (JAR, WAR, EAR, ZIP) that contains a JAR.
- [fix] _agent_: With `duplicates=FAIL`, the error for a duplicate, non-identical class now names the class and how to resolve the problem.
- [fix] _agent_, _teamscale-gradle-plugin_, _teamscale-maven-plugin_: A corrupt class file whose class name cannot be read is skipped with a warning instead of failing the coverage report.
- [fix] _impacted-test-engine_: A test that a failing assumption aborts is reported as skipped instead of as an error.

# 39.0.0
- [breaking] _agent_: The deprecated Docker image `cqse/teamscale-jacoco-agent` is no longer published. Use `cqse/teamscale-java-profiler` instead, which has replaced it since version 36.5.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class TestwiseCoverageCollectingExecutionListener(
)

TestExecutionResult.Status.ABORTED -> TestExecution(
testUniformPath, duration, ETestExecutionResult.ERROR, message
testUniformPath, duration, ETestExecutionResult.SKIPPED, message
)

TestExecutionResult.Status.FAILED -> TestExecution(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import org.junit.platform.engine.EngineExecutionListener
import org.junit.platform.engine.TestExecutionResult
import org.junit.platform.engine.UniqueId
import org.mockito.kotlin.*
import org.opentest4j.TestAbortedException

/** Tests for [TestwiseCoverageCollectingExecutionListener]. */
internal class TestwiseCoverageCollectingExecutionListenerTest {
Expand Down Expand Up @@ -262,6 +263,25 @@ internal class TestwiseCoverageCollectingExecutionListenerTest {
.doesNotContain("null")
}

/** A failing assumption aborts the test, so the test is reported as skipped together with the assumption's message. */
@Test
fun testAbortedTestIsReportedAsSkipped() {
val jupiterRootId = UniqueId.forEngine("junit-jupiter")
val testClassId = jupiterRootId.append(CLASS_SEGMENT_TYPE, "example.AssumptionTest")
val testCase = SimpleTestDescriptor.testCase(testClassId.append(METHOD_SEGMENT_TYPE, "testA()"))
val testClass = SimpleTestDescriptor.testContainer(testClassId, testCase)
val testRoot = SimpleTestDescriptor.testContainer(jupiterRootId, testClass)

val listener = jupiterListener()
listOf(testRoot, testClass, testCase).forEach { listener.executionStarted(it) }
listener.executionFinished(testCase, TestExecutionResult.aborted(TestAbortedException("assumption was not met")))
listOf(testClass, testRoot).forEach { listener.executionFinished(it, TestExecutionResult.successful()) }

Assertions.assertThat(listener.testExecutions.map { it.uniformPath to it.result })
.containsExactly("example/AssumptionTest/testA()" to ETestExecutionResult.SKIPPED)
Assertions.assertThat(listener.testExecutions.single().message).contains("assumption was not met")
}

/** The tests of a skipped `@ParameterizedClass` are no longer in the test tree, but must still be reported. */
@Test
fun testSkipOfParameterizedClass() {
Expand Down
Loading