46
46
import org .assertj .core .api .Condition ;
47
47
import org .junit .jupiter .api .Disabled ;
48
48
import org .junit .jupiter .api .DynamicTest ;
49
+ import org .junit .jupiter .api .Nested ;
49
50
import org .junit .jupiter .api .Test ;
50
51
import org .junit .jupiter .api .TestFactory ;
51
52
import org .junit .platform .engine .TestDescriptor ;
54
55
import org .junit .platform .launcher .LauncherDiscoveryRequest ;
55
56
import org .junit .platform .launcher .TestExecutionListener ;
56
57
import org .junit .platform .launcher .TestIdentifier ;
58
+ import org .junit .platform .launcher .TestPlan ;
57
59
import org .junit .platform .launcher .core .LauncherFactory ;
58
60
import org .junit .platform .testkit .engine .EngineTestKit ;
59
61
import org .junit .platform .testkit .engine .Event ;
@@ -79,9 +81,10 @@ class UniqueIdTrackingListenerIntegrationTests {
79
81
private static final String testD = "[engine:junit-jupiter]/[class:org.junit.platform.launcher.listeners.UniqueIdTrackingListenerIntegrationTests$TestCase3]/[method:testD()]" ;
80
82
private static final String testE = "[engine:junit-jupiter]/[class:org.junit.platform.launcher.listeners.UniqueIdTrackingListenerIntegrationTests$TestCase4]/[method:testE()]" ;
81
83
private static final String testF = "[engine:junit-jupiter]/[class:org.junit.platform.launcher.listeners.UniqueIdTrackingListenerIntegrationTests$TestCase4]/[method:testF()]" ;
84
+ private static final String testG = "[engine:junit-jupiter]/[class:org.junit.platform.launcher.listeners.UniqueIdTrackingListenerIntegrationTests$DisabledTestCase]/[nested-class:Inner]/[method:testG()]" ;
82
85
83
86
private static final String [] expectedUniqueIds = { passingTest , skippedTest , abortedTest , failingTest ,
84
- dynamicTest1 , dynamicTest2 , testA , testB };
87
+ dynamicTest1 , dynamicTest2 , testA , testB , testG };
85
88
86
89
private static final String [] expectedConcurrentUniqueIds = { testA , testB , testC , testD , testE , testF };
87
90
@@ -225,11 +228,21 @@ private static List<String> executeTests(Map<String, String> configurationParame
225
228
.build ();
226
229
LauncherFactory .create ().execute (request , new TestExecutionListener () {
227
230
231
+ private TestPlan testPlan ;
232
+
233
+ @ Override
234
+ public void testPlanExecutionStarted (TestPlan testPlan ) {
235
+ this .testPlan = testPlan ;
236
+ }
237
+
228
238
@ Override
229
239
public void executionSkipped (TestIdentifier testIdentifier , String reason ) {
230
240
if (testIdentifier .isTest ()) {
231
241
uniqueIds .add (testIdentifier .getUniqueId ());
232
242
}
243
+ else {
244
+ this .testPlan .getChildren (testIdentifier ).forEach (child -> executionSkipped (child , reason ));
245
+ }
233
246
}
234
247
235
248
@ Override
@@ -243,7 +256,8 @@ public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult
243
256
}
244
257
245
258
private static ClassSelector [] selectClasses () {
246
- return new ClassSelector [] { selectClass (TestCase1 .class ), selectClass (TestCase2 .class ) };
259
+ return new ClassSelector [] { selectClass (TestCase1 .class ), selectClass (TestCase2 .class ),
260
+ selectClass (DisabledTestCase .class ) };
247
261
}
248
262
249
263
private static Stream <Path > findFiles (String dir , String prefix ) throws IOException {
@@ -340,4 +354,16 @@ void testF() {
340
354
}
341
355
}
342
356
357
+ @ Disabled
358
+ static class DisabledTestCase {
359
+
360
+ @ Nested
361
+ class Inner {
362
+
363
+ @ Test
364
+ void testG () {
365
+ }
366
+ }
367
+ }
368
+
343
369
}
0 commit comments