Thank you Stephen - this was very useful and came just when I am ready
to start piecing together this level of detail.

> > 1) Default vs non-default plugins
> > suddenly a White Rabbit with pink eyes ran close by Alice

So, what I understood from this trip down the rabbit-hole.
- Maven defines various lifecycles.
- Each lifecycle defines a list of phases.
- Each phase will execute a list of goals (defined in plugins).
- What specific goals get executed in each phase depends on the
packaging defined for the pom.xml. Generally package defines what sort
of artifact you are dealing with: jar, war, ear etc.
- I am using ear packaging, so it binds the surefire:test goal to the
test phase, but binds nothing to integration-test - which is why I
need to add the failsafe plugin to my pom.xml. I didn't need to define
a phase for it, because failsafe's default phase is integration-test.

> > 2) Just run integration tests?
> > I can see that unit tests are all classes with names like *Test.java
> > and integration tests are all classes with names like IT.java. But mvn
> > verify and mvn test seem to run all tests (unit and integrations). Is
> > there a way to run just one or the other?

So, going from the previous trip down the rabbit hole, I understand
that when I run "mvn verify" I was seeing unit tests and integration
tests being run because in order to get to the verify phase (where my
integration tests should run from), it was running every phase before
that - including the test phase (where unit tests are run).

> tweaking of
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#skipTests
> should get you there!

When I was running "mvn test", I was also seeing integration tests
being run because I had named my integration test classes
TestBlahBlahIt.java so they were being picked up by both the test and
integration-test phases.

So, I should more strictly follow the convention of
- unit tests being Test*.java - and NOT including IT at the end.
- integration tests being *.IT.java - and NOT starting with Test.


> > 3) Run integration tests after compile?
> > The real reason for question 2 is that I wish to run integration tests
> > only after I have deployed the new application to ensure the
> > integration tests run on the server with the new content. Is there a
> > way to do this?

> Sounds like you should consult my answer to a related question:
> http://stackoverflow.com/questions/16935290/maven-deploy-webapp-to-tomcat-before-junit-test/16936585#16936585

OK, this was very helpful too. In this case, I am working with a
multi-module project and I decided it was best to add our selenium
tests in a new project to keep them away from other project code. We
have 13 pom.xml files, not counting the one I am adding. So this is my
next challenge, to ensure I get this project executing after the
others have done their job and deployed to the app server.

Why, sometimes I've believed as many as five impossible things before
after-noon tea. Time for one more before I knock off at 5pm.

Rob
:)

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

Reply via email to