@@ -8,6 +8,7 @@ import datadog.trace.instrumentation.junit4.MUnitUtils
88import datadog.trace.instrumentation.junit4.TestEventsHandlerHolder
99import org.example.TestFailedAssumptionMUnit
1010import org.example.TestFailedMUnit
11+ import org.example.TestAutomationExcluded
1112import org.example.TestFailedThenSucceedMUnit
1213import org.example.TestSkippedMUnit
1314import org.example.TestSkippedSuiteMUnit
@@ -21,6 +22,38 @@ class MUnitTest extends CiVisibilityInstrumentationTest {
2122
2223 def runner = new JUnitCore ()
2324
25+ def " test automation exclusions preserve a blocking failure and execute once" () {
26+ given :
27+ def id = new TestFQN (" org.example.TestAutomationExcluded" , " protected_failure" )
28+ givenDisabledTests([id])
29+ givenQuarantinedTests([id])
30+ givenAttemptToFixTests([id])
31+ givenFlakyRetryEnabled(true )
32+ givenFlakyTests([id])
33+ givenEarlyFlakinessDetectionEnabled(true )
34+ givenKnownTests([])
35+
36+ when :
37+ runTests([TestAutomationExcluded ], false )
38+
39+ then :
40+ TEST_WRITER . toList(). flatten(). count { it. getTag(" test.name" ) == " protected_failure" } == 1
41+ def testSpan = TEST_WRITER . toList(). flatten(). find { it. getTag(" test.name" ) == " protected_failure" }
42+ testSpan != null
43+ testSpan. getTag(" test.test_management.no_auto_retry" ) == true
44+ testSpan. getTag(" test.test_management.prevent_failure_suppression" ) == true
45+ testSpan. getTag(" test.test_management.is_test_disabled" ) == true
46+ testSpan. getTag(" test.test_management.is_quarantined" ) == true
47+ testSpan. getTag(" test.test_management.is_attempt_to_fix" ) == true
48+ testSpan. getTag(" test.test_management.attempt_to_fix_passed" ) == null
49+ def skippedSpan = TEST_WRITER . toList(). flatten(). find { it. getTag(" test.name" ) == " protected_skip" }
50+ skippedSpan != null
51+ skippedSpan. getTag(" test.test_management.no_auto_retry" ) == true
52+ skippedSpan. getTag(" test.test_management.prevent_failure_suppression" ) == true
53+ skippedSpan. getTag(" test.status" ). toString() == " skip"
54+ }
55+
56+
2457 def " test #testcaseName" () {
2558 runTests(tests)
2659
0 commit comments