diff --git a/.github/workflows/pr-functional-tests.yml b/.github/workflows/pr-functional-tests.yml index e3ac3ffcd10..cefe5d9db4e 100644 --- a/.github/workflows/pr-functional-tests.yml +++ b/.github/workflows/pr-functional-tests.yml @@ -30,4 +30,4 @@ jobs: java-version: ${{ matrix.java }} - name: Build with Maven - run: mvn -B verify -DskipUnitTests=true -DskipModuleFunctionalTests=true -Dtests.max-container-count=5 -DdockerfileName=Dockerfile --file extra/pom.xml + run: mvn -B verify -DskipUnitTests=true -Drun-functional-tests=true -DdockerfileName=Dockerfile --file extra/pom.xml diff --git a/.github/workflows/pr-module-functional-tests.yml b/.github/workflows/pr-module-functional-tests.yml index d87fbe4857a..a731ed35247 100644 --- a/.github/workflows/pr-module-functional-tests.yml +++ b/.github/workflows/pr-module-functional-tests.yml @@ -33,4 +33,4 @@ jobs: run: mvn package -DskipUnitTests=true --file extra/pom.xml - name: Run module tests - run: mvn -B verify -DskipUnitTests=true -DskipFunctionalTests=true -DskipModuleFunctionalTests=false -Dtests.max-container-count=5 -DdockerfileName=Dockerfile-modules --file extra/pom.xml + run: mvn -B verify -DskipUnitTests=true -Drun-module-functional-tests=true -DdockerfileName=Dockerfile-modules --file extra/pom.xml diff --git a/docs/developers/functional-tests.md b/docs/developers/functional-tests.md index 523466fb0b0..0df7447be3a 100644 --- a/docs/developers/functional-tests.md +++ b/docs/developers/functional-tests.md @@ -32,21 +32,15 @@ To prepare the PBS image, follow these steps from the root directory: ## Running Functional Tests -You have two options for running functional tests: +To run functional tests without modules (extra/modules), use: -1. Use `mvn verify` to include all previous steps (including Java tests and modular tests) because Groovy runs in the `failsafe:integration-test` phase. -2. For functional tests only, use a more granular command: - -`mvn -B verify -DskipModuleFunctionalTests=true` +`mvn verify -Drun-functional-tests=true` ## Running Module Functional Tests -You have two options for running modular tests: - -1. Use `mvn verify -DdockerfileName=Dockerfile-modules` to include all previous steps (including Java tests and functional tests) because Groovy runs in the `failsafe:integration-test` phase. -2. For modular tests only, use a more granular command: +To run module-only functional tests, use: -`mvn -B verify -DskipUnitTests=true -DskipFunctionalTests=true -DskipModuleFunctionalTests=false -DdockerfileName=Dockerfile-modules` +`mvn verify -Drun-module-functional-tests=true -DdockerfileName=Dockerfile-modules` ## Developing @@ -58,20 +52,17 @@ Functional tests need to have name template **.\*Spec.groovy** Primary Key will be inserted after saving instance into DB. - `/functional/service/PrebidServerService` - responsible for all PBS http calls. - `/functional/testcontainers/Dependencies` - stores dependencies and manages mySql and NetworkServiceContainer containers. -- `/functional/testcontainers/ErrorListener` - logs request and response in case of falling test. - `/functional/testcontainers/PbsConfig` - collects PBS properties. - `/functional/testcontainers/PbsServiceFactory` - manage PBS containers according to container limit. -- `/functional/testcontainers/PBSTestExtension` - allows to hook into a spec’s lifecycle to add ErrorListener using annotation `PBSTest`. - `/functional/testcontainers/TestcontainersExtension` - allow to hook into a spec’s lifecycle to start and stop support service containers using global extension. -- `/functional/testcontainers/container` - responsible for creating and configuring containers. -- `/functional/testcontainers/scaffolding/NetworkScaffolding` - makes HTTP requests to a MockServer. +- `/functional/testcontainers/container/*` - responsible for creating and configuring containers. +- `/functional/testcontainers/scaffolding/NetworkScaffolding` - makes HTTP requests to a MockServer. **Properties:** -`launchContainers` - responsible for starting the MockServer and the MySQLContainer container. Default value is false to not launch containers for unit tests. +`launchContainers` - responsible for starting the MockServer and MySQLContainer container. Default value is false to not launch containers for functional tests. `tests.max-container-count` - maximum number of simultaneously running PBS containers. Default value is 5. -`skipFunctionalTests` - allow to skip funtional tests. Default value is false. `skipUnitTests` - allow to skip unit tests. Default value is false. **Debug:** diff --git a/extra/pom.xml b/extra/pom.xml index cbf3012ff8d..712d9b879bb 100644 --- a/extra/pom.xml +++ b/extra/pom.xml @@ -66,8 +66,6 @@ false - false - true diff --git a/pom.xml b/pom.xml index 1c198a3df57..c4dde28ea4b 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 @@ -375,6 +376,7 @@ false ${skipUnitTests} + spock @@ -386,20 +388,6 @@ true - - - functional-tests - - ${skipFunctionalTests} - - - - module-functional-tests - - ${skipModuleFunctionalTests} - - - org.codehaus.gmavenplus @@ -585,69 +573,6 @@ - - org.codehaus.gmavenplus - gmavenplus-plugin - - true - - - ${project.basedir}/src/test/groovy - - **/*.groovy - - - - - - - - compileTests - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - ${mockserver.version} - ${project.version} - 5 - false - - - - - functional-tests - - integration-test - verify - - - - **/tests/module/**/*Spec - - - **/*Spec - - - - - module-functional-tests - - integration-test - verify - - - - **/tests/module/**/*Spec - - - - - org.apache.maven.plugins maven-compiler-plugin @@ -660,6 +585,25 @@ + + Enabling function tests + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + true + + ${skipUnitTests} + spock + + + + + Container debugging @@ -677,5 +621,132 @@ + + Run general functional tests without modules + + + run-functional-tests + true + + + + + + org.codehaus.gmavenplus + gmavenplus-plugin + + true + + + ${project.basedir}/src/test/groovy + + **/*.groovy + + + + + + + + compileTests + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + ${mockserver.version} + ${project.version} + 5 + + false + + + + + general-functional-tests + + integration-test + verify + + + + **/tests/module/**/*Spec + + + **/*Spec + + + + + + + + + + Run only module functional tests + + + run-module-functional-tests + true + + + + + + org.codehaus.gmavenplus + gmavenplus-plugin + + true + + + ${project.basedir}/src/test/groovy + + **/*.groovy + + + + + + + + compileTests + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + ${mockserver.version} + ${project.version} + 5 + + false + + + + + module-functional-tests + + integration-test + verify + + + + **/tests/module/**/*Spec + + + + + + + +