lundi 25 septembre 2017

Gradle - Clover - unit and integration test coverage

I work on a project which contains integration and unit tests in a seperate directory. For both test types I want to generate the test coverage with Gradle Clover Plugin. The goal would be to create two Gradle tasks which are able to:

  1. Generate coverage repor for unit tests
  2. Generate coverage repor for unit and integration tests

The first task (clover-unit-test) works fine. Then I though I just have to create another task, add the integration test source to the classpath and execute the first task. Somehow in this way:

task 'clover-integ-test'(dependsOn: 'clover-unit-test') {
    sourceSets.test.java.srcDirs = ['unit-tests', 'integration-tests']
}

Although this task seems working fine, it prevents me from running the unit tests independently. But I don't know how else I could seperate these test types.

Is there any possibility to create two clover configuration (one for unit tests and another one for integration tests with different source directories)?

OR

Is it possible to merge the source directories and execute clover-unit-test directly?

I would really appreciate any help!

Aucun commentaire:

Enregistrer un commentaire