From 048034f85e9d50f98ec1defcc6b2a4c88215faad Mon Sep 17 00:00:00 2001 From: Dominik Remo <47261058+DominikRemo@users.noreply.github.com> Date: Thu, 14 Sep 2023 22:56:29 +0200 Subject: [PATCH] Change Order for Test Class Execution Order got reshuffled by #7160 after we have already fixed many flaky tests. A fixed order might mitigate this issue. Co-Authored-By: Lara Dvorsek <73339358+laadvo@users.noreply.github.com> --- .../AbstractSpringIntegrationBambooBitbucketJiraTest.java | 2 -- .../AbstractSpringIntegrationGitlabCIGitlabSamlTest.java | 2 -- .../artemis/AbstractSpringIntegrationJenkinsGitlabTest.java | 2 -- .../artemis/AbstractSpringIntegrationLocalCILocalVCTest.java | 2 -- .../de/tum/in/www1/artemis/AbstractSpringIntegrationTest.java | 2 -- .../artemis/service/scheduled/cache/quiz/QuizCacheTest.java | 2 -- src/test/resources/junit-platform.properties | 4 ++-- 7 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationBambooBitbucketJiraTest.java b/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationBambooBitbucketJiraTest.java index effda8e0dfe3..6607569ad6e4 100644 --- a/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationBambooBitbucketJiraTest.java +++ b/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationBambooBitbucketJiraTest.java @@ -16,7 +16,6 @@ import java.util.Set; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Order; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.ExecutionMode; @@ -60,7 +59,6 @@ import de.tum.in.www1.artemis.web.rest.vm.ManagedUserVM; import io.zonky.test.db.AutoConfigureEmbeddedDatabase; -@Order(1) @SpringBootTest @AutoConfigureMockMvc @ExtendWith(SpringExtension.class) diff --git a/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationGitlabCIGitlabSamlTest.java b/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationGitlabCIGitlabSamlTest.java index 78a5dd719ae9..fb9b4f0af34d 100644 --- a/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationGitlabCIGitlabSamlTest.java +++ b/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationGitlabCIGitlabSamlTest.java @@ -11,7 +11,6 @@ import org.gitlab4j.api.GitLabApiException; import org.gitlab4j.api.models.PipelineStatus; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Order; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.ExecutionMode; @@ -44,7 +43,6 @@ import de.tum.in.www1.artemis.util.AbstractArtemisIntegrationTest; import io.zonky.test.db.AutoConfigureEmbeddedDatabase; -@Order(5) @SpringBootTest @AutoConfigureMockMvc @ExtendWith(SpringExtension.class) diff --git a/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationJenkinsGitlabTest.java b/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationJenkinsGitlabTest.java index e844d43e2089..0361716068b1 100644 --- a/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationJenkinsGitlabTest.java +++ b/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationJenkinsGitlabTest.java @@ -13,7 +13,6 @@ import org.gitlab4j.api.GitLabApiException; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Order; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.ExecutionMode; @@ -42,7 +41,6 @@ import de.tum.in.www1.artemis.util.AbstractArtemisIntegrationTest; import io.zonky.test.db.AutoConfigureEmbeddedDatabase; -@Order(2) @SpringBootTest @AutoConfigureMockMvc @ExtendWith(SpringExtension.class) diff --git a/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationLocalCILocalVCTest.java b/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationLocalCILocalVCTest.java index 62c8c48ffca9..2d4be7b9e015 100644 --- a/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationLocalCILocalVCTest.java +++ b/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationLocalCILocalVCTest.java @@ -11,7 +11,6 @@ import org.gitlab4j.api.GitLabApiException; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Order; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.ExecutionMode; @@ -57,7 +56,6 @@ // Must start up an actual web server such that the tests can communicate with the ArtemisGitServlet using JGit. // Otherwise, only MockMvc requests could be used. The port this runs on is defined at server.port (see @TestPropertySource). // Note: Cannot use WebEnvironment.RANDOM_PORT here because artemis.version-control.url must be set to the correct port in the @TestPropertySource annotation. -@Order(4) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) @AutoConfigureMockMvc @ExtendWith(SpringExtension.class) diff --git a/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationTest.java b/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationTest.java index 05d9bebabbf4..f722ca7354e8 100644 --- a/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationTest.java +++ b/src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationTest.java @@ -6,7 +6,6 @@ import java.util.Set; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Order; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.ExecutionMode; @@ -30,7 +29,6 @@ /** * This SpringBootTest is used for tests that only require a minimal set of Active Spring Profiles. */ -@Order(3) @SpringBootTest @AutoConfigureMockMvc @ExtendWith(SpringExtension.class) diff --git a/src/test/java/de/tum/in/www1/artemis/service/scheduled/cache/quiz/QuizCacheTest.java b/src/test/java/de/tum/in/www1/artemis/service/scheduled/cache/quiz/QuizCacheTest.java index c6ef7f31c7c8..0873ae6535c1 100644 --- a/src/test/java/de/tum/in/www1/artemis/service/scheduled/cache/quiz/QuizCacheTest.java +++ b/src/test/java/de/tum/in/www1/artemis/service/scheduled/cache/quiz/QuizCacheTest.java @@ -8,7 +8,6 @@ import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Order; import org.junit.jupiter.api.parallel.Isolated; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; @@ -33,7 +32,6 @@ import de.tum.in.www1.artemis.user.UserUtilService; @Isolated -@Order(Integer.MAX_VALUE) class QuizCacheTest extends AbstractSpringIntegrationTest { private static final String TEST_PREFIX = "quizcachetest"; diff --git a/src/test/resources/junit-platform.properties b/src/test/resources/junit-platform.properties index 05917f24e407..a2754a0609bb 100644 --- a/src/test/resources/junit-platform.properties +++ b/src/test/resources/junit-platform.properties @@ -1,8 +1,8 @@ # Enables junit5 parallel test execution. Tests are run on one JVM instance. junit.jupiter.execution.parallel.enabled = true -# Enables ordering test-classes with JUnit5 by @Order annotation (Used to start integration tests before unit tests). -junit.jupiter.testclass.order.default = org.junit.jupiter.api.ClassOrderer$OrderAnnotation +# Enables ordering test-classes with JUnit5 by class name. +junit.jupiter.testclass.order.default = org.junit.jupiter.api.ClassOrderer$ClassName # Enables JUnit5 automatic detection of extensions. junit.jupiter.extensions.autodetection.enabled = true