diff --git a/.github/workflows/pr-functional-tests.yml b/.github/workflows/pr-functional-tests.yml index d512022413a..1315cb5be10 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 c3b04858677..188f50506db 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..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 2cb81b6464a..08bcf1a5aea 100644 --- a/extra/pom.xml +++ b/extra/pom.xml @@ -67,8 +67,6 @@ false - false - true diff --git a/pom.xml b/pom.xml index 73513000b95..8ce3bed3080 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 @@ -386,6 +387,7 @@ false ${skipUnitTests} + spock @@ -397,20 +399,6 @@ true - - - functional-tests - - ${skipFunctionalTests} - - - - module-functional-tests - - ${skipModuleFunctionalTests} - - - org.codehaus.gmavenplus @@ -597,32 +585,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 @@ -631,46 +607,57 @@ - functional-tests + integration-test integration-test verify - - - **/tests/module/**/*Spec - + + + + + org.codehaus.gmavenplus + gmavenplus-plugin + ${gmavenplus-plugin.version} + + true + + + ${project.basedir}/src/test/groovy - **/*Spec + **/*.groovy - - + + + + - module-functional-tests - integration-test - verify + compileTests - - - **/tests/module/**/*Spec - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - ${java.version} - - + + Enabling function tests + + + + org.apache.maven.plugins + maven-surefire-plugin + + + true + + + + + + Container debugging @@ -688,5 +675,60 @@ + + Run general functional tests without modules + + + run-functional-tests + true + + + + + + org.codehaus.gmavenplus + gmavenplus-plugin + + + org.apache.maven.plugins + maven-failsafe-plugin + + + **/tests/module/**/*Spec + + + **/*Spec + + + + + + + + Run only module functional tests + + + run-module-functional-tests + true + + + + + + org.codehaus.gmavenplus + gmavenplus-plugin + + + org.apache.maven.plugins + maven-failsafe-plugin + + + **/tests/module/**/*Spec + + + + + +