@@ -37,6 +37,8 @@ public class AllureJunit5 implements TestExecutionListener {
3737 private static final Logger LOGGER = LoggerFactory .getLogger (AllureJunit5 .class );
3838
3939 private static final String TAG = "tag" ;
40+ private static final String SUITE = "suite" ;
41+ private static final String PACKAGE = "package" ;
4042
4143
4244 private final ThreadLocal <String > tests
@@ -72,15 +74,49 @@ public void executionStarted(final TestIdentifier testIdentifier) {
7274
7375 methodSource .ifPresent (source -> {
7476 result .setDescription (getDescription (source ));
75- result .getLabels ().add (new Label ().withName ("suite" ).withValue (getSuite (source )));
76- result .getLabels ().add (new Label ().withName ("package" ).withValue (source .getClassName ()));
77+ result .getLabels ().add (new Label ().withName (SUITE ).withValue (getSuite (source )));
78+ result .getLabels ().add (new Label ().withName (PACKAGE ).withValue (source .getClassName ()));
7779 });
7880
7981 getLifecycle ().scheduleTestCase (result );
8082 getLifecycle ().startTestCase (uuid );
8183 }
8284 }
8385
86+ @ Override
87+ public void executionSkipped (final TestIdentifier testIdentifier , final String reason ) {
88+ if (testIdentifier .isTest ()) {
89+ final String uuid = tests .get ();
90+ final TestResult result = new TestResult ()
91+ .withUuid (uuid )
92+ .withName (testIdentifier .getDisplayName ())
93+ .withLabels (getTags (testIdentifier ))
94+ .withHistoryId (getHistoryId (testIdentifier ))
95+ .withStage (Stage .RUNNING );
96+
97+ testIdentifier
98+ .getSource ()
99+ .filter (MethodSource .class ::isInstance )
100+ .map (MethodSource .class ::cast )
101+ .ifPresent (source -> {
102+ result .setDescription (getDescription (source ));
103+ result .getLabels ().add (new Label ().withName (SUITE ).withValue (getSuite (source )));
104+ result .getLabels ().add (new Label ().withName (PACKAGE ).withValue (source .getClassName ()));
105+ });
106+
107+ getLifecycle ().scheduleTestCase (result );
108+ getLifecycle ().startTestCase (uuid );
109+
110+ tests .remove ();
111+ getLifecycle ().updateTestCase (uuid , testResult -> {
112+ testResult .setStage (Stage .FINISHED );
113+ testResult .setStatus (SKIPPED );
114+ });
115+ getLifecycle ().stopTestCase (uuid );
116+ getLifecycle ().writeTestCase (uuid );
117+ }
118+ }
119+
84120 @ Override
85121 public void executionFinished (final TestIdentifier testIdentifier , final TestExecutionResult testExecutionResult ) {
86122 if (testIdentifier .isTest ()) {
0 commit comments