You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by jp4 <jo...@hnpsolutions.com> on 2006/11/03 22:59:53 UTC

mvn site running test cases twice

I am using the surefire report plugin as well as coberatura, javadoc and
checkstyle..  When I do a mvn site it runs my test cases twice.  I have read
other threads on this issue, but I haven't seen a definitive resolution... 
Is there one?  We have a done of tests that get run nightly and now I know
why the build takes so long.  Any feedback would be greatly appreciated.

jp4
-- 
View this message in context: http://www.nabble.com/mvn-site-running-test-cases-twice-tf2571386s177.html#a7168325
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: mvn site running test cases twice

Posted by Arnaud Bailly <ab...@oqube.com>.
jp4 <jo...@hnpsolutions.com> writes:

> This seems like a big issue since our nightly builds usually run all of our
> unit and container test cases.  If we have to run the tests twice, it will
> almost double the build time which is already several hours.
>
> Is there any way to instrument without invoking the test cases?  It seems
> like you would want to clean, compile, instrument, test, install create site
> docs.  Has anyone found a workaround?
>

Hello John,

Nor sure it can help you, but following another discussion with
Vincent Massol, I have a better understanding of the problem and maybe
some beginning of a solution: The problem, is that if you follow your
standard cycle, you would end up with  a jar containing instrumented
files which is certainly not what you want. This is why clover (and
probably cobertura) plugin fork another lifecycle to run tests and
generate reports with instrumented class or source files.

A simple solution would be to "profile"  the coverage build: you could
then run two builds chained one on another, one with coverage
instrumentation on and tests run, and another without coverage and
tests. The problem still is that you need to modify coverage plugin
*not to fork*, but this may be simpler than modifying maven :-) 

my 50 cents,
-- 
OQube < software engineering \ génie logiciel >
Arnaud Bailly, Dr.
\web> http://www.oqube.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: mvn site running test cases twice

Posted by Matt Campbell <ma...@gmail.com>.
>From what i read on the maven site plugin, it forks the different
report plugins into separate lifecycles. So since both of the plugins
require the test cases to be compiled, both lifecycles are going to have to
compile them in there own lifecycles.

Not sure as I havent done much research on this yet, but what if the maven
site plugin compiled the sources then ran the report plugins, neither of the
plugins would need to compile the test sources then.

 Please correct me if im wrong.




On 11/7/06, Craig McClanahan <cr...@apache.org> wrote:
>
> On 11/7/06, jp4 <jo...@hnpsolutions.com> wrote:
> >
> >
> > This seems like a big issue since our nightly builds usually run all of
> > our
> > unit and container test cases.  If we have to run the tests twice, it
> will
> > almost double the build time which is already several hours.
>
>
> The Shale build also includes Cobertura (thanks to Wendy :-), and it only
> runs the second set of tests twice if you execute "site" ... if you
> execute
> only "install" it just does the normal one time.  Is it required that your
>
> nightly builds generate the site?
>
> If it is, you might see if Maven has a command line option to suppress the
> "normal" test phase ... since you know the tests will be run anyway by the
> plugin.  Before relying on this, though, I'd want to verify that a test
> failure during the Cobertura part actually does abort the build so you
> hear
> about them.
>
> Is there any way to instrument without invoking the test cases?  It seems
> > like you would want to clean, compile, instrument, test, install create
> > site
> > docs.  Has anyone found a workaround?
>
>
> The way that Cobertura works, it has to actually execute the tests (using
> the instrumented classes) in order to determine which code paths you've
> covered and which you haven't.  Just instrumenting wouldn't accomplish
> much
> that is useful.
>
> Thanks,
> >
> > jp4
>
>
> Craig
>
>
> Wendy Smoak-3 wrote:
> > >
> > > On 11/7/06, jp4 < john.pfeifer@hnpsolutions.com> wrote:
> > >
> > >> I removed the coberatura plugin and unit test cases run only once...
> > >> Here is
> > >> what I have in my pom
> > > ...
> > >> Any ideas?  Looks like the test cases get run during instrumentation?
> > >
> > > I think it's normal based on Maven's current design.  The tests are
> > > run once during the 'test' phase, then in order to produce the
> > > coverage report, the tests have to be re-run on the instrumented code.
> > >
> > > Take a look at this post from Vincent which talks about a similar
> > > issue with the Clover plugin:
> > >
> >
> http://www.nabble.com/-M2--My-tests-are-launched-3-times-%21-t2190279s177.html#a6075779
> > >
> > > --
> > > Wendy
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > >
> >
> > --
> > View this message in context:
> >
> http://www.nabble.com/mvn-site-running-test-cases-twice-tf2571386s177.html#a7226443
> > Sent from the Maven - Users mailing list archive at Nabble.com<http://nabble.com/>
> .
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>

Re: mvn site running test cases twice

Posted by Craig McClanahan <cr...@apache.org>.
On 11/7/06, jp4 <jo...@hnpsolutions.com> wrote:
>
>
> This seems like a big issue since our nightly builds usually run all of
> our
> unit and container test cases.  If we have to run the tests twice, it will
> almost double the build time which is already several hours.


The Shale build also includes Cobertura (thanks to Wendy :-), and it only
runs the second set of tests twice if you execute "site" ... if you execute
only "install" it just does the normal one time.  Is it required that your
nightly builds generate the site?

If it is, you might see if Maven has a command line option to suppress the
"normal" test phase ... since you know the tests will be run anyway by the
plugin.  Before relying on this, though, I'd want to verify that a test
failure during the Cobertura part actually does abort the build so you hear
about them.

Is there any way to instrument without invoking the test cases?  It seems
> like you would want to clean, compile, instrument, test, install create
> site
> docs.  Has anyone found a workaround?


The way that Cobertura works, it has to actually execute the tests (using
the instrumented classes) in order to determine which code paths you've
covered and which you haven't.  Just instrumenting wouldn't accomplish much
that is useful.

Thanks,
>
> jp4


Craig


Wendy Smoak-3 wrote:
> >
> > On 11/7/06, jp4 <jo...@hnpsolutions.com> wrote:
> >
> >> I removed the coberatura plugin and unit test cases run only once...
> >> Here is
> >> what I have in my pom
> > ...
> >> Any ideas?  Looks like the test cases get run during instrumentation?
> >
> > I think it's normal based on Maven's current design.  The tests are
> > run once during the 'test' phase, then in order to produce the
> > coverage report, the tests have to be re-run on the instrumented code.
> >
> > Take a look at this post from Vincent which talks about a similar
> > issue with the Clover plugin:
> >
> http://www.nabble.com/-M2--My-tests-are-launched-3-times-%21-t2190279s177.html#a6075779
> >
> > --
> > Wendy
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/mvn-site-running-test-cases-twice-tf2571386s177.html#a7226443
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: mvn site running test cases twice

Posted by jp4 <jo...@hnpsolutions.com>.
This seems like a big issue since our nightly builds usually run all of our
unit and container test cases.  If we have to run the tests twice, it will
almost double the build time which is already several hours.

Is there any way to instrument without invoking the test cases?  It seems
like you would want to clean, compile, instrument, test, install create site
docs.  Has anyone found a workaround?

Thanks,

jp4



Wendy Smoak-3 wrote:
> 
> On 11/7/06, jp4 <jo...@hnpsolutions.com> wrote:
> 
>> I removed the coberatura plugin and unit test cases run only once... 
>> Here is
>> what I have in my pom
> ...
>> Any ideas?  Looks like the test cases get run during instrumentation?
> 
> I think it's normal based on Maven's current design.  The tests are
> run once during the 'test' phase, then in order to produce the
> coverage report, the tests have to be re-run on the instrumented code.
> 
> Take a look at this post from Vincent which talks about a similar
> issue with the Clover plugin:
> http://www.nabble.com/-M2--My-tests-are-launched-3-times-%21-t2190279s177.html#a6075779
> 
> -- 
> Wendy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mvn-site-running-test-cases-twice-tf2571386s177.html#a7226443
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: mvn site running test cases twice

Posted by Wendy Smoak <ws...@gmail.com>.
On 11/7/06, jp4 <jo...@hnpsolutions.com> wrote:

> I removed the coberatura plugin and unit test cases run only once...  Here is
> what I have in my pom
...
> Any ideas?  Looks like the test cases get run during instrumentation?

I think it's normal based on Maven's current design.  The tests are
run once during the 'test' phase, then in order to produce the
coverage report, the tests have to be re-run on the instrumented code.

Take a look at this post from Vincent which talks about a similar
issue with the Clover plugin:
http://www.nabble.com/-M2--My-tests-are-launched-3-times-%21-t2190279s177.html#a6075779

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: mvn site running test cases twice

Posted by jp4 <jo...@hnpsolutions.com>.
I removed the coberatura plugin and unit test cases run only once...  Here is
what I have in my pom

build section

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

reporting section

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
      </plugin>

Any ideas?  Looks like the test cases get run during instrumentation?

Thanks,
jp4

Wendy Smoak-3 wrote:
> 
> On 11/3/06, jp4 <jo...@hnpsolutions.com> wrote:
> 
>> I am using the surefire report plugin as well as coberatura, javadoc and
>> checkstyle..  When I do a mvn site it runs my test cases twice.
> 
> Does it happen if you remove the Cobertura plugin?  We use surefire,
> javadoc and checkstyle in the Struts build, and the tests don't run
> twice.
> 
> -- 
> Wendy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mvn-site-running-test-cases-twice-tf2571386s177.html#a7225137
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: mvn site running test cases twice

Posted by "Orford, Ian" <Ia...@dkib.com>.
That's exactly the reason - surefire runs the tests and cobertura runs
the tests.

I guess the question is, could these two plugins collaborate and just
run the reports once?

Ian
 

-----Original Message-----
From: Wendy Smoak [mailto:wsmoak@gmail.com] 
Sent: 04 November 2006 23:54
To: Maven Users List
Subject: Re: mvn site running test cases twice

On 11/3/06, jp4 <jo...@hnpsolutions.com> wrote:

> I am using the surefire report plugin as well as coberatura, javadoc 
> and checkstyle..  When I do a mvn site it runs my test cases twice.

Does it happen if you remove the Cobertura plugin?  We use surefire,
javadoc and checkstyle in the Struts build, and the tests don't run
twice.

--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


--------------------------------------------------------------------------------
The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express 
written permission of the sender. If you are not the intended recipient, please 
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to 
http://www.dresdnerkleinwort.com/disc/email/ or contact the sender. 
--------------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: mvn site running test cases twice

Posted by Wendy Smoak <ws...@gmail.com>.
On 11/3/06, jp4 <jo...@hnpsolutions.com> wrote:

> I am using the surefire report plugin as well as coberatura, javadoc and
> checkstyle..  When I do a mvn site it runs my test cases twice.

Does it happen if you remove the Cobertura plugin?  We use surefire,
javadoc and checkstyle in the Struts build, and the tests don't run
twice.

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org