Why does Clover, using test optimization, keeps executing the tests which were only necessary to execute in the previous build?

Ingmar van der Steen May 17, 2012

I have a question regarding the way Clover is optimizing the tests that should run during a Maven build.
After a change to some sourcecode only the relevant tests to that change are executed. But what I do not understand is why after a next build Clover still keeps executing those tests. I have the following configuration for Maven:

(plugin.txt)

I execute a Maven build using: mvn integration-test -Pclover

When I run a Maven build using Clover for the first time it correctly produces the following log:

(log1.txt)

When I run a new Maven build it correctly does not execute any tests according to the following log:

(log2.txt)

Then after changing some sourcecode it correctly executes the relevant tests accoring to the following log:

(log3.txt)


So far so good, but when I run a new build without changing sourcecode it still executes the same tests as log3.txt:

(log4.txt)

I would expect that in log4.txt no tests are executed, because nothing changed in comparison to the previous build. Am I invoking Clover incorrectly or...?

1 answer

0 votes
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 24, 2012

Please note that maven-clover2-plugin has two goals for test optimization:

1) clover2:optimize - which optimizes the 'test' phase

2) clover2:optimizeIntegration - which optimizes 'integration-test' phase


According to log files, you're running the 'integration-test', so please try to use the 'optimizeIntegration' goal.

Regards
Marek

Heather Wells July 11, 2012

Does the optimizeIntegration goal work only with surefire, or does it work with failsafe as well?

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 11, 2012
Heather Wells July 11, 2012

I saw that guide already, but it doesn't mention the optimizeIntegration goal. Clover reporting of my surefire and failsafe test works fine, but when I try to run clover2:optimizeIntegration it always runs all of the failsafe tests (that is to say, it doesn't appear to optimize with failsafe).

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 12, 2012

I wasn't precise enough, sorry. :) Clover:

  • supports both surefire and failsafe plugins in such way that you can execute tests and generate reports out of them
  • supports test optimization for surefire for both 'test' and 'integration-test' phase, but
  • does not support test optimization for failsafe plugin.

I have corrected sentence in manual.

You can always raise a feature request on https://jira.atlassian.com/browse/CLOV for failsafe test optimization. We'll check if/when it could be done.

Furthermore, as Clover-for-Maven is open-source you are welcome to contribute. :)

Ingmar van der Steen July 25, 2012

I would expect when invoking: mvn test -Pclover, using the 'optimize' goal configured in my pom.xml (see: plugin.txt above) it should work. However it still runs all tests when no changes are made to the source code in comparison to the previous build.


Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events