Hello Paul,
thanks for advice.. still i got it failing.
as of report, i have 100% code coverage for my tests, but when i run
cobertura as part
of mvn clean install, it errors with following message:

Cobertura: Saved information on 14 classes.
[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
    [echo] ...Deleting stale web.xml ...
[INFO] Executed tasks
[INFO] [cobertura:check {execution: check}]
[INFO] Cobertura 1.7 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 14 classes.

[ERROR] Project failed check. Total branch coverage rate of 60.0% is below
80.0%
Project failed check. Total line coverage rate of 43.6% is below 80.0%


i am now wondering if i am missing something in my pom.xml ..

<plugin>
       <groupId>org.codehaus.mojo</groupId>
       <artifactId>cobertura-maven-plugin</artifactId>
       <version>2.0</version>
       <configuration>
         <check>
           <totalLineRate>80</totalLineRate>
           <totalBranchRate>80</totalBranchRate>
         </check>
       </configuration>
       <executions>
          <execution>
           <id>clean</id>
           <goals>
             <goal>clean</goal>
           </goals>
         </execution>
         <execution>
           <id>check</id>
           <goals>
             <goal>check</goal>
           </goals>
         </execution>
       </executions>
     </plugin>

i was also wondering if anyone is using cobertura this way (as part of
build) or everyone is using
it as part of report..
it would be nice if i can make it part of build so taht it blocks creation
of jar/war if there's not enough coverage, however
i am beginning to wonder if the original intent of cobertura was just for a
report...

thanks and regards
marco


On 7/2/07, Paul Spencer <[EMAIL PROTECTED]> wrote:

Marco,
You may be seeing the bug MCOBERTURA-61[1] in 2.1.  I use 2.0 for that
reason.  As to the test running twice, I see this also.

vaul Spencer

[1]http://jira.codehaus.org/browse/MCOBERTURA-61

Marco Mistroni wrote:
> hi all,
> in my mvn2 webapp i am currently using Cobertura under the 'report'
> section, to get a  test coverage report when i build the site.
> However, i woudl like to apply cobertura also to my build, so that mvn
wont
> build anything until i have tested at least, let's say, 80% of my
code..(i
> normally
> do TDD, but i just want also maven to force me to do TDD in case i
> forget :)
>
> the problem is that, when i run it as part of my build ,  i keep on
getting
> following exception
>
> INFO] Cobertura 1.8 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
> Cobertura: Loaded information on 14 classes.
> [cobertura] DEBUG [main] net.sourceforge.cobertura.check.Main - Class
> com.mm.webwork.HelloWorldIntro, line coverage rate: 0.0%, branch
coverage
> rate: 100.0%
> [cobertura] DEBUG [main] net.sourceforge.cobertura.check.Main - Class
> com.mm.testbean.TestManager, line coverage rate: 100.0%, branch coverage
> rate: 100.0%
> [cobertura] DEBUG [main] net.sourceforge.cobertura.check.Main - Class
> com.mm.webwork.jobapp.JobAppRedirect, line coverage rate: 0.0%, branch
> coverage rate: 100.0%
> [cobertura] DEBUG [main] net.sourceforge.cobertura.check.Main - Class
> com.mm.webwork.agencies.AgencyView, line coverage rate: 0.0%, branch
> coverage rate: 0.0%
> [cobertura] DEBUG [main] net.sourceforge.cobertura.check.Main - Class
> com.mm.webwork.agencies.AgencyUpdate, line coverage rate: 0.0%, branch
> coverage rate: 0.0%
> [cobertura] DEBUG [main] net.sourceforge.cobertura.check.Main - Class
> com.mm.webwork.agencies.AgencyRedirect, line coverage rate: 0.0%, branch
> coverage rate: 100.0%
> [cobertura] DEBUG [main] net.sourceforge.cobertura.check.Main - Class
> com.mm.webwork.constants.Constants, line coverage rate: 0.0%, branch
> coverage rate: 100.0%
> [cobertura] DEBUG [main] net.sourceforge.cobertura.check.Main - Class
> com.mm.webwork.jobapp.JobApplicationUpdate, line coverage rate: 0.0%,
> branch
> coverage rate: 0.0%
> [cobertura] DEBUG [main] net.sourceforge.cobertura.check.Main - Class
> com.mm.webwork.HelloWorld, line coverage rate: 0.0%, branch coverage
rate:
> 100.0%
> [cobertura] DEBUG [main] net.sourceforge.cobertura.check.Main - Class
> WebWorkApp.App, line coverage rate: 0.0%, branch coverage rate: 100.0%
> [cobertura] DEBUG [main] net.sourceforge.cobertura.check.Main - Class
> com.mm.testbean.TestManagerImpl, line coverage rate: 0.0%, branch
coverage
> rate: 100.0%[cobertura] DEBUG [main]
net.sourceforge.cobertura.check.Main -
> Class com.mm.webwork.login.Login, line coverage rate: 0.0%, branch
coverage
> rate: 100.0%
> [cobertura] DEBUG [main] net.sourceforge.cobertura.check.Main - Class
> com.mm.webwork.jobapp.SearchJobApplication, line coverage rate: 0.0%,
> branch
> coverage rate: 0.0%
> [cobertura] DEBUG [main] net.sourceforge.cobertura.check.Main - Class
> com.mm.webwork.agencies.SearchAgency, line coverage rate: 0.0%, branch
> coverage rate: 0.0%
>
> [DEBUG] --------------------
> [DEBUG] --------------------
> [DEBUG]  Standard error from the Cobertura task:
> [DEBUG] --------------------
> [ERROR] Project failed check. Total branch coverage rate of 0.0% is
below
> 80.0%
> Project failed check. Total line coverage rate of 0.0% is below 80.0%
>
> [DEBUG] --------------------
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Coverage check failed. See messages above.
> [INFO]
> ------------------------------------------------------------------------
> [DEBUG] Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: Coverage check
> failed. See messages above.
>        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> DefaultLifecycleExecutor.java:564)
>        at
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
>
> (DefaultLifecycleExecutor.java:480)
>        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
> DefaultLifecycleExecutor.java:459)
>        at
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
>
> (DefaultLifecycleExecutor.java:311)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
> DefaultLifecycleExecutor.java:278)
>        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
> DefaultLifecycleExecutor.java:143)
>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java
> :315)
>        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>        at org.codehaus.classworlds.Launcher.mainWithExitCode(
Launcher.java
> :430)
>        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Coverage
check
> failed. See messages above.
>        at org.codehaus.mojo.cobertura.tasks.CheckTask.execute(
> CheckTask.java:99)
>        at org.codehaus.mojo.cobertura.CoberturaCheckMojo.execute
> (CoberturaCheckMoj
> o.java:63)
>        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
> DefaultPluginManager.java:443)
>        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> DefaultLifecycleExecutor.java:539)
>        ... 16 more
> [INFO] -------------------------------------------
>
>
> Plus, my test are being run twice..
>
> i am running mvn by invoking mvn clean install..  i am assuming i am
doing
> something terribly wrong or i missed some config parameters..
> here's my pom.xml (only relevant part)
>
> ******
>
> <plugin>
>        <groupId>org.codehaus.mojo</groupId>
>        <artifactId>cobertura-maven-plugin</artifactId>
>        <configuration>
>          <check>
>            <totalLineRate>80</totalLineRate>
>            <totalBranchRate>80</totalBranchRate>
>          </check>
>        </configuration>
>        <executions>
>          <execution>
>            <id>clean</id>
>            <goals>
>              <goal>clean</goal>
>            </goals>
>          </execution>
>          <execution>
>            <id>check</id>
>            <goals>
>              <goal>check</goal>
>            </goals>
>          </execution>
>        </executions>
>      </plugin>
>      <plugin>
>        <artifactId>maven-antrun-plugin</artifactId>
>        <executions>
>          <execution>
>            <phase>test</phase>
>            <goals>
>              <goal>run</goal>
>            </goals>
>            <configuration>
>              <tasks>
>                <taskdef name="webdoclet" classname="
> xdoclet.modules.web.WebDocletTask">
>                  <classpath refid="maven.test.classpath" />
>                  <classpath refid="maven.compile.classpath"/>
>                </taskdef>
>                <echo>...Deleting stale web.xml ...</echo>
>            <!--    <delete
> file="${basedir}/src/main/webapp/WEB-INF/web.xml"/>
>                <webdoclet destdir="${basedir}/src/main/webapp/WEB-INF"
> mergedir="${basedir}/src/merge"
>                        verbose="true">
>                  <fileset dir="${basedir}/src/main/java"/>
>                  <deploymentdescriptor />
>                  <jbosswebxml />
>                </webdoclet>-->
>              </tasks>
>            </configuration>
>          </execution>
>        </executions>
>      </plugin>
>      <plugin>
>        <artifactId>maven-war-plugin</artifactId>
>        <version>2.0</version>
>        <configuration>
>          <warName>SpringApp</warName>
>
> <outputDirectory>${jbossDir}/server/default/deploy</outputDirectory>
>        </configuration>
>      </plugin>
>    </plugins>
>
> ******
> if anyone would be so kind to help me out, i'll appreciate it :)
> and additionally, how cobertura plugin is generally used in maven2
> projects>? as a report tool or as a 'build' plugin to force you to do
TDD?
>
> thanks and regards
>  Marco
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to