-
1. Re: Maven Failsafe Plugin
jnorris10 Mar 5, 2010 11:01 PM (in response to alrubinger)Andrew, thanks. Your surefire example suits my needs perfectly. I never understood why surefire needed to be forked (ie: the failsafe plugin) to accomplish this anyway, and the failsafe name is truly bizarre to me. I've dropped it now in favor of this. Thanks. -
2. Re: Maven Failsafe Plugin
alrubinger Mar 6, 2010 12:00 AM (in response to jnorris10)Ah cool. Yep, it's working for me pretty well too.
If you look at that Sonatype post, I have a comment at the bottom which asks about reliably getting the output JAR (artifact) filename for use in the tests. Their example has both the artifactId and version hardcoded in.
This is in line with some other discussions we'd been having where we'd like a ShrinkWrap archive to represent the "current" artifact, so we're testing what's built. The drawback here is that you'd have to run the full build to get the test, as opposed to currently (where the IDE can incrementally compile and then execute if you define what's targeted for the artifact).
S,ALR
-
3. Re: Maven Failsafe Plugin
germanescobar Mar 6, 2010 11:24 AM (in response to alrubinger)Just one minor thing I noticed in your solution: your integration tests will be included in unit tests. The problem is that surefire plugin includes the **/*TestCase.java pattern (which includes your **/*IntegrationTestCase.java). So, either you directly exclude that pattern for unit tests or change your pattern for integration tests (i.e. **/*TestIntegration.java).
Now, that makes me think if you can declare two times the surefire plugin, once for unit tests and the other for integration tests. Is that why you use a profile for your integration tests? In that case, the FailSafe Plugin would make sense.
What I think of the FailSafe plugin is that is a shortcut for what you are doing, where you don't need to specify the phase or to include the <includes> tag (as the article says, the FailSafe plugin will look for a different pattern).
-
4. Re: Maven Failsafe Plugin
germanescobar Mar 6, 2010 11:48 AM (in response to germanescobar)germanescobar wrote:
Now, that makes me think if you can declare two times the surefire plugin, once for unit tests and the other for integration tests. Is that why you use a profile for your integration tests? In that case, the FailSafe Plugin would make sense.
Just realized that you can have multiple executions and configuration is per execution.
-
5. Re: Maven Failsafe Plugin
alrubinger Mar 6, 2010 11:53 AM (in response to germanescobar)Actually, my pattern for Surefire unit tests is configured to "**/*UnitTestCase.java".
Justin Edelson just gave us some more insight; Failsafe Plugin will apparently execute the post-integration-test phase even on test failure, where Surefire will not. That's an interesting point to consider if the container start/stop/deploy/undeploy is handled by pre-integration or post- phases. For Arquillian, luckily we have it all running as part of the test itself, so we sidestep these issues and handle shutdown gracefully in a "finally" anyway.
S,
ALR