Skip to end of metadata
Go to start of metadata
The golden rule is that mvn clean install should ALWAYS return Build Successful.
This means that the test suite which is run by default cannot depend on any external resources like database, JMS, Files, WebServices, etc.

This does not mean that you cannot have tests that use in-memory, embedded alternatives! For now let's assume that we have two types of tests: simple unit tests that only test business and doesn't need any external environment and tests that need external services. Lets look at a concrete example to make things more concrete.

How to set this up

  1. Annotate the tests in question
  2. Configure surefire (in pom.xml) to exclude these groups of tests
  3. Remember to enable the profile to run all tests in the continuous integration server.
    1. In Jenkins, Build - Goals and options:
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Aug 29, 2009

    After reading the TestNG book, I had a question on how to run a specific set ofgroups from a CI server.

    The solution above is a very good description, Erik.

    Do you know of another solution, where we don´t need multiple copies of testng.xml and profiles?
    Secario on the CI server:
    Fast tests every 15 min/every commit.
    Slow tests every 30 min.
    Tests with online database (environment) every hour.
    Tests with external WebService (environment-external or integration) twice a day.

    Hope we can find a way to avoid having 4 xml files, and 4 profiles.

    1. Nov 01, 2010

      We need support for these concepts in Maven core or the surefire plugin to make this integration less ugly. I don't know the support in Maven3 and the latest surefire plugin yet, but will updated if/when I find a better approach.