maharsuresh / int-test-coverage

Integration Test Coverage with jacoco-maven-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Integration Test Coverage with JaCoCo - Presentation Link

This is an example project showing how to generate coverage reports for integration tests run against a remote server. The server will be run in docker, and the integration tests (written in Cucumber) will hit the remote urls.

Pre-requisites

  1. Docker
  2. Maven
  3. JDK 8

Module Layout

server

Simple spring boot application that manages contacts and phone numbers backed by a postgres database
NOTE - requires postgres db running locally if server is running in IDE. To run, spin up a docker container just for postgres with command

docker run -p5432:5432 -i -t postgres:9.6.7

integration-tests

Integration tests written with Cucumber BDD

multi-module-server

Same as the server module, but broken into separate modules for web and persistence layer

Running int test coverage

  1. Build the server module and run docker image
    cd server
    mvn clean package
    docker-compose build
    docker-compose up
    
  2. Run the integration tests (in a new terminal)
    cd integration-tests
    mvn clean test -Pone
    
  3. Stop server (in same terminal docker-compose up was run)
     Ctrl^C
     docker-compose down
    
  4. Examine results in integration-tests/target/coverage-report/html

Running test test coverage with multi-module-server

  1. Build the server module and run docker image
    cd multi-module-server
    mvn clean install -f modules/pom.xml
    mvn clean package
    docker-compose build
    docker-compose up
    
  2. Run the integration tests (in a new terminal)
    cd integration-tests
    mvn clean test -Pmulti
    
  3. Stop server (in same terminal docker-compose up was run)
     Ctrl^C
     docker-compose down
    
  4. Examine results in integration-tests/target/coverage-report/html

About

Integration Test Coverage with jacoco-maven-plugin

License:MIT License


Languages

Language:Java 71.1%Language:Shell 15.4%Language:Batchfile 11.9%Language:Gherkin 1.6%