Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

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.

Example

Service Group Name Suggestion
Oracle database db-oracle
BEA JMS Broker jms-bea
Webservice1 webservice1
Webservice2 webservice2
  1. Annotate each test that depend on any of these services with the appropriate groups. (Multiple groups for a test is OK.)
  2. Create two testng configuration files.
    • testng.xml - run all fast tests that doesn't require any environment.
    • testng-test-all-environments.xml - run slow tests and tests that depend environment
  3. Update pom.xml with the following surefire configuration
    • use testng.xml by default.
    • Add a profile to pom.xml to run the tests that require environment. These can then be activated by running mvn test -P test-all-environments.
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.