Integration tests are run using the maven failsafe plugin. For detailed information see the Maven failsafe documentation.
Short version:
Usually the following are unit tests:
The following should be considered integration tests:
The failsafe plugin needs to be configured in the pom.xml. For simplicity sake (buildserver and Sonar integration), the failsafe reports are put in the same folder as the surefire (unit tests) reports.
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.17</version> <configuration> <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory> </configuration> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-junit47</artifactId> <version>2.17</version> </dependency> </dependencies> </plugin> </plugins> </build> |
When you execute mvn verify then first the unit tests will be executed, followed by the integration tests. You can run only the integration tests by running mvn failsafe:integration-test. If you start from a clean checkout, you need to compile them as well: use mvn compile test-compile failsafe:integration-test.
If a module extends the database schema, it should preferably have one or more integration tests that perform the module installation and can easily be re-run against different datasources.
Integration tests can easily be written using the Across test library, see /wiki/spaces/AX/pages/12648455.
The buildserver is provided with a default across-test.properties containing the following datasources:
Datasource | DBMS |
---|---|
mysql | MySQL 5 (linux) |
oracle | Oracle 11G (Windows) |
mssql | SQL Server 2008 |
See /wiki/spaces/AX/pages/12648483 for naming conventions and sql scripts