Skip to content

Commit

Permalink
Change Order for Test Class Execution
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
DominikRemo and laadvo committed Sep 14, 2023
1 parent 6824f44 commit 048034f
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/junit-platform.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 048034f

Please sign in to comment.