Skip to content

Commit 2246eb1

Browse files
committed
Attempt to add extension that extends TestExecutionListener
1 parent c974360 commit 2246eb1

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

components/context/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ jmh {
88
version = "1.28"
99
}
1010

11+
dependencies {
12+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
13+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.0")
14+
implementation("org.junit.platform:junit-platform-launcher:1.9.0")
15+
}
16+
1117
val excludedClassesInstructionCoverage by extra {
1218
listOf("datadog.context.ContextProviders") // covered by forked test
1319
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
datadog.context.SourceFileExtension
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package datadog.context;
2+
3+
import org.junit.platform.engine.TestExecutionResult;
4+
import org.junit.platform.launcher.TestExecutionListener;
5+
import org.junit.platform.launcher.TestIdentifier;
6+
import org.junit.platform.launcher.TestPlan;
7+
8+
public class SourceFileExtension implements TestExecutionListener {
9+
public void executionStarted(TestIdentifier testIdentifier) {
10+
System.out.println("EXECUTIONSTARTED.");
11+
}
12+
13+
public void testPlanExecutionStarted(TestPlan testPlan) {
14+
System.out.println("TESTPLANEXECUTIONSTARTED.");
15+
}
16+
17+
public void executionFinished(
18+
TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {
19+
System.out.println("EXECUTIONFINISHED.");
20+
// get test source file info here
21+
}
22+
23+
public void testPlanExecutionFinished(TestPlan testPlan) {
24+
System.out.println("TESTPLANEXECUTIONFINISHED.");
25+
// get xml report file
26+
// modify report with test source file info
27+
// save resulting file
28+
}
29+
}

0 commit comments

Comments
 (0)