Configuring Clover in IntelliJ 13.1 and Maven 3

Hello,

I didn't manage to find how to configure Clover so it would be able to know what is a test and what is not in my project hierarchy. For now, all my code is considered having 0% coverage rate, even my tests themself in the "cloverage" panel, and nothing is displayed in "Test Runs" panel.

I'm using Clover as a plug-in for IntelliJ 13.1. Note that I'm working on a maven project having 3 sub-modules with the default organization ( /src/main for the "real code" and /src/test for the tests to run for each sub-module.)

I've read through the documentation for clover and IDEA but I didn't find my solution. Plus, the interface of IDEA seams to have changed, for example in the "compiler" part of the settings, there isn't an "external build" option anymore.

Do you have any idea about it ?

Thank you !

3 answers

1 accepted

0 votes
Accepted answer

I didn't manage to find how to configure Clover so it would be able to know what is a test and what is not in my project hierarchy.

Clover-for-IDEA assumes that all sources which:

  • are located under 'Test Source Folders' (see File -> Project Structure -> Modules -> select a module -> Sources tab) and
  • are written in a framework recognized by Clover (JUnit3, JUnit4, TestNG, Instinct)

are test sources. All others are treated as application source.

Please ensure that you have a following check box selected, so that tests are instrumented:

File -> Settings -> Project Settings -> Clover -> Compilation tab -> Instrumentation box

"Instrument test source folders to enable per-test coverage and test optimization"

0 votes

For now, all my code is considered having 0% coverage rate.

Do you see your application and test classes in the "Cloverage" view? Do you see your source code coloured in red?

  • If the answer is "yes" in both cases, then it means that your code has been instrumented by Clover but code coverage has not been recorded. There are few possible reasons of lack of code coverage, the most common are:
    • clover.db is not found/accessible by tests and application under test - this may happen when, for instance:
      • you're running tests on another machine (e.g. deploying to jboss)
      • or you're using a relative path in initstring and running tests from a different working directory (so that Clover is unable to find the database)

        - you shall see warning messages in execution logs in this case
    • clover.jar is not on the class path when running your tests - both unit tests and application under test must have clover.jar on the classpath - in most cases they're launched directly from IDEA, in a single JVM, and Clover's JAR is already avaialble (see the global library named 'Clover IDEA Plugin' in your project); the JAR may be unavailable when:
      • you're launching tests in a non-standard way (by a script for instance)
      • your application is running in a separate JVM (on an application server for instance)
  • If the answer is "no", then it seems that you have not enabled Clover in your project or your project is written in a language not supported by Clover
    • please note that Clover supports both Java and Groovy but Groovy is not supported in IDEA and Eclipse IDEs (CLOV-939)
    • open the File -> Settings -> Project Settings -> Clover and check if 'Enable Clover' checkbox is selected
0 votes

Plus, the interface of IDEA seams to have changed, for example in the "compiler" part of the settings, there isn't an "external build" option anymore.

Indeed, since IDEA 13 this option is not available anymore - the IDEA 13 is using the "external build" feature by default.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in United States

Topic Tuesday: What's your favorite topic?

Good morning All, Our goal is to get you into the habit of while enjoying your favorite morning drink you are checking the NOVA "space" for topics and comments. Your input is really needed and...

68 views 4 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you