jenkins the definitive guide

(Jeff_L) #1
<configuration>
<skip>true</skip>¶
</configuration>
<executions>
<execution>·
<id>unit-tests</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</execution>
<execution> ̧
<id>integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
...

¶ Skip all tests by default—this deactivates the default Maven test configuration.
· During the unit test phase, run the tests but exclude the integration tests.
̧ During the integration test phase, run the tests but only include the integration tests.


This will ensure that the integration tests are skipped during the unit test phase, and only executed during
the integration test phase.


If you don’t want to put unwanted constraints on the names of your test classes, you can use package
names instead. In the project illustrated in Figure A.1, “A project containing freely-named test classes”,
all of the functional tests have been placed in a package called webtests. There is no constraint on the
names of the tests, but we are using Page Objects to model our application user interface, so we also
make sure that no classes in the pages package (underneath the webtests package) are treated as tests.

Free download pdf