maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxime Gréau <greaumax...@gmail.com>
Subject Re: Testing jar files instead of class files
Date Fri, 22 Aug 2014 19:27:42 GMT
Hello,

This is exactly what I want to do.
Is it the bug you are talking about ?
https://jira.codehaus.org/browse/SUREFIRE-855

Regards
Maxime Gréau.


2013-04-30 13:28 GMT+02:00 Stephen Connolly <stephen.alan.connolly@gmail.com
>:

> Well just to put this into context.
>
> What you actually want to do is run your second set of tests after the
> 'package' phase and before the 'install' phase. There is only the 'deploy'
> phase after the 'install' phase so there would be no scope to run tests
> after the 'install' phase.
>
> If you look at the lifecycle, you will see the handy:
>
> 'integration-test'
> and
> 'verify'
>
> phases.
>
> Now use of these phases is slightly different. Because you actually *never*
> want to type "mvn integration-test" and any time you think you do, you
> should actually type "mvn verify" in its place.
>
> The reason for this is that the "pre-integration-test" and
> "post-integration-test" phases are designed to allow setting up and tearing
> down the integration test environment, and, despite their names, the
> post-integration-test phase is *not* a finally block. So you need to be
> careful when binding plugins to the integration-test phase that such
> plugins *never* fail the build...
>
> At this point we have the Maven Failsafe Plugin enter the fray... this has
> two goals: failsafe:integration-test and failsafe:verify which, by default,
> bind to the integration-test and verify phases respectively.
>
> The `failsafe:integration-test` goal will run integration tests, but never
> fails the build.
> The `failsafe:verify` goal will check the results of
> `failsafe:integration-test` and fail the build if the tests fail.
>
> Thus you should be able to add failsafe to the mix by just adding
>
> <plugin>
> <artifactId>maven-failsafe-plugin</artifactId>
> <executions>
> <execution>
> <goals>
> <goal>integration-test</goal>
> <goal>verify</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
>
> Now since failsafe is running after the `package` phase, it *should* be
> using the project artifact in place of target/classes *when* executed after
> the `package` phase... as all plugins should do... *but* I suspect there is
> a bug in failsafe that causes it to explicitly add target/classes.
>
> TL;DR it should be Maven Failsafe Plugin that gives this feature *but* I
> suspect there is a bug in that plugin that is causing it to use the
> directory in place of the .jar.
>
> Kristian, can you confirm my summary?
>
> -Stephen
>
>
> On 30 April 2013 12:11, Stephen Colebourne <scolebourne@joda.org> wrote:
>
> > I would like to be able to achieve the following using two command
> > line invocations:
> > - build and install jar files using "mvn install"
> > - run tests again, but against the installed jar files
> >
> > The rationale is that the first mvn run will only run "unit" tests
> > (using test groups in TestNG), whereas the second mvn run would run
> > all tests, including "slow" and "database" tests. In reality, both
> > would be run from a CI server rather than a developer desktop.
> >
> > Clearly, the first mvn run is easy (I have that working). But I cannot
> > see a way to run a mvn command that executes the tests against the
> > installed jar files.
> >
> > The project is a multi-module project. Moving tests into a separate
> > "testing only" project is not an acceptable approach. Running the
> > slow/database tests as part of a single mvn run is not an acceptable
> > approach.
> >
> > thanks for any thoughts or hyperlinks.
> > Stephen
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message