From fafac63c1a0adb8debeba6782840f0406b44c930 Mon Sep 17 00:00:00 2001 From: Jonathan Lermitage Date: Wed, 22 Jan 2020 22:52:54 +0100 Subject: [PATCH] (pom) reintroduce failsafe to run integration tests --- README.md | 2 +- do | 2 +- do.cmd | 2 +- pom.xml | 110 +++++++----------------------------------------------- 4 files changed, 16 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index aae55383..45e4e75d 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Some experimentation with **Spring Boot 2**, JDK8+, JUnit5, TestNG, SQL (HSQLDB, * Java **architecture tests** via [**ArchUnit**](https://github.com/TNG/ArchUnit). See last commit of [spring5-light-archunit](https://github.com/jonathanlermitage/manon/tree/spring5-light-archunit) branch * use dockerized **MariaDB** on **[Travis](https://travis-ci.org/jonathanlermitage/manon)** CI instead of embedded HSQLDB. See last commit of [spring5-light-travis-with-mariadb](https://github.com/jonathanlermitage/manon/tree/spring5-light-travis-with-mariadb) branch * use dockerized **PostgreSQL** on **[Travis](https://travis-ci.org/jonathanlermitage/manon)** CI. See last commit of [postgres](https://github.com/jonathanlermitage/manon/tree/postgres) branch - * **split Unit and Integration Tests**: run Unit Tests first and, if they don't fail, run Integration Tests. See last commit of [spring5-light-separate-integ-unit](https://github.com/jonathanlermitage/manon/tree/spring5-light-separate-integ-unit) branch. Due to JDK11+JUnit5+Failsafe issues ([that may be fixed in Failsafe 3.0.0](https://maven.apache.org/surefire/maven-failsafe-plugin/)), I run both Integration and Unit tests via Surefire Maven plugin + * ~~**split Unit and Integration Tests**: run Unit Tests first and, if they don't fail, run Integration Tests. See last commit of [spring5-light-separate-integ-unit](https://github.com/jonathanlermitage/manon/tree/spring5-light-separate-integ-unit) branch. Due to JDK11+JUnit5+Failsafe issues ([that may be fixed in Failsafe 3.0.0](https://maven.apache.org/surefire/maven-failsafe-plugin/)), I run both Integration and Unit tests via Surefire Maven plugin~~ I now use Surefire + Failsafe, and it works well (2020-01-22) * **[Gatling](https://gatling.io) benchmark**. See last commit of [spring5-light-gatling](https://github.com/jonathanlermitage/manon/tree/spring5-light-gatling) branch and dedicated [README.md](docker/gatling/README.md) file * **migration from MongoDB** (used to store regular and authentication data) to **MariaDB**. See last commit of [spring5-light-mongo-to-sql](https://github.com/jonathanlermitage/manon/tree/spring5-light-mongo-to-sql) branch * tests work with an **embedded MongoDB** instance (for data) and HSQLDB (for Spring Batch internals only), that means you don't have to install any database to test project diff --git a/do b/do index 183c24f2..81e2c3fe 100755 --- a/do +++ b/do @@ -116,7 +116,7 @@ for ((cmd = 1; cmd <= $#; cmd++)); do ;; "itc") - sh ./mvnw verify -P coverage-it + sh ./mvnw verify -P coverage -DskipUT=true ;; "b") diff --git a/do.cmd b/do.cmd index a68d60be..29f74d1d 100644 --- a/do.cmd +++ b/do.cmd @@ -49,7 +49,7 @@ if [%1] == [tc] ( mvnw clean verify -P coverage ) if [%1] == [itc] ( - mvnw clean verify -P coverage-it + mvnw clean verify -P coverage -DskipUT=true ) if [%1] == [b] ( mvnw clean compile -DskipUT=true -DskipIT=true -T1 diff --git a/pom.xml b/pom.xml index c45be886..4f078cbd 100644 --- a/pom.xml +++ b/pom.xml @@ -496,40 +496,23 @@ org.apache.maven.plugins maven-surefire-plugin - true + ${skipUT} + ${surefireArgLine} ${surefireProfileArgLine} ${surefirePerformanceArgLine} + ${project.build.directory} + + false + + + + org.apache.maven.plugins + maven-failsafe-plugin + + ${skipIT} ${surefireArgLine} ${surefireProfileArgLine} ${surefirePerformanceArgLine} ${project.build.directory} false - - - unit-tests - test - - test - - - ${skipUT} - - **/*Test.java - - - - - integration-tests - integration-test - - test - - - ${skipIT} - - **/*IT.* - - - - org.codehaus.mojo @@ -658,81 +641,14 @@ - - - - - - - coverage-it - - - - org.jacoco - jacoco-maven-plugin - ${jacoco-maven-plugin.version} - - - pre-integration-test - - prepare-agent - - - ${project.build.directory}/jacoco.exec - coverageSurefireArgLine - - - - post-integration-test - post-integration-test - - report - - - ${project.build.directory}/jacoco.exec - ${project.reporting.outputDirectory}/jacoco - - manon/document/** - manon/model/** - manon/Application.* - - - - - org.apache.maven.plugins - maven-surefire-plugin + maven-failsafe-plugin ${surefireArgLine} ${surefireProfileArgLine} ${surefirePerformanceArgLine} @{coverageSurefireArgLine} - - - unit-tests - test - - test - - - true - - - - integration-tests - integration-test - - test - - - false - - **/*IT.* - - - -