diff --git a/.github/workflows/pr-functional-tests.yml b/.github/workflows/pr-functional-tests.yml index f2f8fb0c571..7065abe3a14 100644 --- a/.github/workflows/pr-functional-tests.yml +++ b/.github/workflows/pr-functional-tests.yml @@ -39,6 +39,7 @@ jobs: run: | mvn -B verify \ -DskipUnitTests=true \ + -Drun-functional-tests=true \ -DskipModuleFunctionalTests=true \ -Dtests.max-container-count=5 \ -DdockerfileName=Dockerfile \ diff --git a/.github/workflows/pr-module-functional-tests.yml b/.github/workflows/pr-module-functional-tests.yml index 6741e45b1d6..4105ebe696d 100644 --- a/.github/workflows/pr-module-functional-tests.yml +++ b/.github/workflows/pr-module-functional-tests.yml @@ -42,6 +42,7 @@ jobs: run: | mvn -B verify \ -DskipUnitTests=true \ + -Drun-module-functional-tests=true \ -DskipFunctionalTests=true \ -DskipModuleFunctionalTests=false \ -Dtests.max-container-count=5 \ diff --git a/docs/developers/functional-tests.md b/docs/developers/functional-tests.md index 523466fb0b0..fceec11cff0 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 -B 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 0beed8d405f..86059735ce4 100644 --- a/extra/pom.xml +++ b/extra/pom.xml @@ -69,8 +69,6 @@ false - false - true diff --git a/pom.xml b/pom.xml index ddd4a8794ca..9d5b592bb6f 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 @@ -394,6 +395,7 @@ false ${skipUnitTests} + spock @@ -406,25 +408,29 @@ true - - - functional-tests - - ${skipFunctionalTests} - - - - module-functional-tests - - ${skipModuleFunctionalTests} - - - org.codehaus.gmavenplus gmavenplus-plugin ${gmavenplus-plugin.version} + + true + + + ${project.basedir}/src/test/groovy + + **/*.groovy + + + + + + + + compileTests + + + @@ -605,32 +611,20 @@ - org.codehaus.gmavenplus - gmavenplus-plugin + org.apache.maven.plugins + maven-compiler-plugin - true - - - ${project.basedir}/src/test/groovy - - **/*.groovy - - - + ${java.version} + ${java.version} - - - - compileTests - - - org.apache.maven.plugins maven-failsafe-plugin + ${maven-failsafe-plugin.version} + true ${mockserver.version} ${project.version} 5 @@ -639,31 +633,11 @@ - functional-tests + integration-test integration-test verify - - - **/tests/module/**/*Spec - - - **/*Spec - - - - - module-functional-tests - - integration-test - verify - - - - **/tests/module/**/*Spec - - @@ -672,10 +646,33 @@ - - Container debugging + enabling-function-tests + + + + org.codehaus.gmavenplus + gmavenplus-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + + true + + + + + + + + container-debugging + + org.codehaus.gmavenplus + gmavenplus-plugin + org.apache.maven.plugins maven-failsafe-plugin @@ -688,5 +685,60 @@ + + run-general-functional-tests + + + run-functional-tests + true + + + + + + org.codehaus.gmavenplus + gmavenplus-plugin + + + org.apache.maven.plugins + maven-failsafe-plugin + + + **/tests/module/**/*Spec + + + **/*Spec + + + + + + + + run-module-functional-tests + + + run-module-functional-tests + true + + + + + + org.codehaus.gmavenplus + gmavenplus-plugin + + + org.apache.maven.plugins + maven-failsafe-plugin + + + **/tests/module/**/*Spec + + + + + +