Issue with clover on jboss

vasya petrov November 8, 2012

Hello, I have a server and it is running my app. I want to get the metrics from Clover on remote(distrebuted) testing my application I am testing my application with a browser, after each test, get the files Clover(i e: clover.db5nb4l4_h99zod5p) further generated report using the mvn clover2: clover, resulting in a blank report, ie covering code 0%, what am I doing wrong?

3 answers

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

Have you seen this manual: Using Clover for web applications? Please note that Distributed Coverage must be enabled only if both conditions are met:

  • tests are being executed in a different JVM than application code called by them (for example JUnits executed during build calls servlets deployed on Tomcat, or EJBs on JBoss) and
  • you're interested in the per-test coverage feature (i.e. which test methods have covered which business methods) or you're interested in the test optimization feature

According to your description, you don't have unit tests but you test the application manually. So first condition is not met.

I propose following modifications in your pom.xml:

  • remove the whole <distributedCoverage> section
  • add flushPolicy (interval or threaded, default is threaded) and flushInterval (default 500ms) - optional

One more thing: how do you copy clover.db to your JBoss installation? I don't see <cloverDatabase> attribute defined in pom.xml. Do you have -Dclover.initstring=/path/to/clover.db declared as JBoss' JVM argument?

0 votes
vasya petrov November 8, 2012

Thanks for your answer, Accepted my application get requests and answers responses.

I just send requests from the browser. And get response from my app.

My application consists of two modules: webapp and servlet parts, the servlet part loaded into webapp as jar library. In both parts in the pom.xml is written the same clover configuration (is this correct?)

feature of my application is: webapp part is not Java classes used for this module so is therefore not created clover.db (Am I right?)

my clover configuration(for webapp part and server part):

&lt;build&gt;
        &lt;plugins&gt;
            &lt;plugin&gt;
                &lt;groupId&gt;com.atlassian.maven.plugins&lt;/groupId&gt;
                &lt;artifactId&gt;maven-clover2-plugin&lt;/artifactId&gt;
                &lt;version&gt;3.1.6&lt;/version&gt;
                &lt;configuration&gt;
                    &lt;distributedCoverage&gt;
                        &lt;numClients&gt;1&lt;/numClients&gt;
                    &lt;/distributedCoverage&gt;
                    
                    &lt;licenseLocation&gt;clover.license&lt;/licenseLocation&gt;
                &lt;/configuration&gt;

                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;phase&gt;process-sources&lt;/phase&gt;
                        &lt;goals&gt;
                            &lt;goal&gt;setup&lt;/goal&gt;
                        &lt;/goals&gt;
                    &lt;/execution&gt;
                    &lt;execution&gt;
                        &lt;id&gt;log&lt;/id&gt;
                        &lt;phase&gt;verify&lt;/phase&gt;
                        &lt;goals&gt;
                            &lt;goal&gt;log&lt;/goal&gt;
                            &lt;goal&gt;check&lt;/goal&gt;
                            &lt;goal&gt;clover&lt;/goal&gt;
                        &lt;/goals&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;
            &lt;/plugin&gt;
        &lt;/plugins&gt;
    &lt;/build&gt;

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

I'm not sure whether you have a distributed test or not:

  • do you have two (or more) JVMs running your application? do you have <distributedCoverage> feature configured in your build? do you have unit tests running on a different JVM than application under test? if all answers are yes, then it's a Clover's Distributed Coverage feature
  • if your web application is running on single JVM and you perform testing using the web browser then probably it's not a Distributed Coverage feature

What do you exactly mean by "testing application with a browser":

  • manual tests or
  • junits simulating user actions, i.e. there's a chain like: junit (JVM on test machine) -> browser (non-java process) -> application (JVM on JBoss)?

Could you give more details how Clover is configured in your pom.xml?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events