You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2023/02/24 19:43:00 UTC
[maven-integration-testing] branch miss-tests created (now 553fc5be9)
This is an automated email from the ASF dual-hosted git repository.
sjaranowski pushed a change to branch miss-tests
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git
at 553fc5be9 Detecting tests which was not added to TestSuiteOrdering
This branch includes the following new commits:
new 553fc5be9 Detecting tests which was not added to TestSuiteOrdering
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[maven-integration-testing] 01/01: Detecting tests which was not added to TestSuiteOrdering
Posted by sj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sjaranowski pushed a commit to branch miss-tests
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git
commit 553fc5be960b20a45df4a88c925a051afc878182
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Fri Feb 24 20:42:40 2023 +0100
Detecting tests which was not added to TestSuiteOrdering
Even test is skipped by `@Disabled` annotation
newer surefire schedule it for execution.
When tests are missing in TestSuiteOrdering
are executed as one of first tests in unpredictable order.
---
core-it-suite/pom.xml | 2 ++
.../it/MavenITmng5206PlexusLifecycleHonoured.java | 2 ++
.../maven/it/MavenITmng5503ZipInReactorTest.java | 2 ++
.../org/apache/maven/it/TestSuiteOrdering.java | 27 +++++++++++++++++++---
4 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/core-it-suite/pom.xml b/core-it-suite/pom.xml
index 5724c27bf..276df29f5 100644
--- a/core-it-suite/pom.xml
+++ b/core-it-suite/pom.xml
@@ -498,6 +498,8 @@ under the License.
<includes>
<include>**/MavenIT*.java</include>
</includes>
+ <!-- test annotated by @Tag("disabled") will be skipped from executions -->
+ <excludedGroups>disabled</excludedGroups>
<forkCount>0</forkCount>
<reuseForks>true</reuseForks>
<skip>true</skip>
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5206PlexusLifecycleHonoured.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5206PlexusLifecycleHonoured.java
index a0e6e27d9..2090a5ec1 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5206PlexusLifecycleHonoured.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5206PlexusLifecycleHonoured.java
@@ -25,6 +25,7 @@ import org.apache.maven.shared.verifier.Verifier;
import java.io.File;
import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
/**
@@ -32,6 +33,7 @@ import org.junit.jupiter.api.Test;
*
* @author Olivier Lamy
*/
+@Tag("disabled")
@Disabled
public class MavenITmng5206PlexusLifecycleHonoured
extends AbstractMavenIntegrationTestCase
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5503ZipInReactorTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5503ZipInReactorTest.java
index b95e3fd81..50994049f 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5503ZipInReactorTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5503ZipInReactorTest.java
@@ -25,6 +25,7 @@ import org.apache.maven.shared.verifier.Verifier;
import java.io.File;
import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
/**
@@ -32,6 +33,7 @@ import org.junit.jupiter.api.Test;
*
* @author jvz
*/
+@Tag( "disabled" )
@Disabled
public class MavenITmng5503ZipInReactorTest
extends AbstractMavenIntegrationTestCase
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
index c44203deb..0ea14e504 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
@@ -22,14 +22,17 @@ package org.apache.maven.it;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.apache.maven.shared.verifier.Verifier;
import org.junit.jupiter.api.ClassDescriptor;
import org.junit.jupiter.api.ClassOrderer;
import org.junit.jupiter.api.ClassOrdererContext;
+import org.junit.jupiter.api.Tag;
/**
* The Core IT suite.
@@ -39,6 +42,9 @@ public class TestSuiteOrdering implements ClassOrderer
private static PrintStream out = System.out;
+ // store missed test to show info only once
+ private final static List<Class<?>> MISSED_TESTS = new ArrayList<>();
+
final Map<Class<?>, Integer> tests = new HashMap<>();
private static void infoProperty( PrintStream info, String property )
@@ -744,21 +750,36 @@ public class TestSuiteOrdering implements ClassOrderer
*/
}
- void addTestSuite( Class<?> clazz ) {
+ void addTestSuite( Class<?> clazz )
+ {
addTestSuite( clazz, tests.size() );
}
- void addTestSuite( Class<?> clazz, int order ) {
+ void addTestSuite( Class<?> clazz, int order )
+ {
tests.put( clazz, order );
}
- int getIndex( ClassDescriptor cd ) {
+ int getIndex( ClassDescriptor cd )
+ {
Integer i = tests.get( cd.getTestClass() );
return i != null ? i : -1;
}
public void orderClasses( ClassOrdererContext context )
{
+ context.getClassDescriptors().stream()
+ .filter( cd -> !MISSED_TESTS.contains( cd.getTestClass() ) )
+ .filter( cd -> getIndex( cd ) == -1 )
+ .filter( cd -> cd.findRepeatableAnnotations( Tag.class ).stream()
+ .noneMatch( t -> "disabled".equals( t.value() ) ) )
+ .forEach( cd -> {
+ out.println( "Test " + cd.getTestClass()
+ + " is not present in TestSuiteOrdering " + System.lineSeparator()
+ + "\t- please add it or annotate with @Tag(\"disabled\")" + System.lineSeparator() );
+ MISSED_TESTS.add( cd.getTestClass() );
+ } );
+
context.getClassDescriptors().sort( Comparator.comparing( this::getIndex ) );
}