There is nothing special about the pre- and post- phases

There is no contract that says they will be executed if the
integration-test phase is invoked.

This is why we have the failsafe plugin.

Failsafe runs the tests and _does_not_fail_the_build_if_the_tests_fail_

In general the rules you should follow is:

1. never ever invoke the pre-integration-test, integration-test, or
post-integration-test phases directly.  If you want to run integration
tests invoke the "verify" phase (or any later phase)

2. Never ever fail the build in the integration-test phase

3. Attach an execution to the verify phase that checks the integration
test results and fails the build if necessary.

HTH

-Stephen

On 26 January 2011 13:15, Mathieu CARROLLE
<[email protected]> wrote:
> Hi,
>
> I am using failsafe plugin to run integration test. In my case, I have 3
> ph^ase : start container, run test and stop container.
> If the phase "run test" failed, the stop phase is never called.
> Is this behaviour due to a configuration problem or a bug ?
>
> Here is my configuration :
> <?xml version="1.0" encoding="UTF-8"?>
> <project>
>     [....]
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-failsafe-plugin</artifactId>
> <version>2.7.1</version>
> <executions>
> <execution>
> <id>integration-test</id>
> <goals>
> <goal>integration-test</goal>
> </goals>
> </execution>
> <execution>
> <id>verify</id>
> <goals>
> <goal>verify</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-antrun-plugin</artifactId>
> <version>1.6</version>
> <executions>
> <execution>
> <id>start-container</id>
> <phase>pre-integration-test</phase>
> <goals>
> <goal>run</goal>
> </goals>
> <configuration>
> <tasks description="container : STARTING">
> <echo message="================================" />
> <echo message="= STARTING container... =" />
> <echo message="================================" />
>                                        [...]
> </tasks>
> </configuration>
> </execution>
>
> <execution>
> <id>integration-component-test</id>
> <phase>integration-test</phase>
> <goals>
> <goal>run</goal>
> </goals>
> <configuration>
> <tasks description="container : RUNNING Integration Test">
> <echo message="================================" />
> <echo message="= RUNNING integration test.... =" />
> <echo message="================================" />
>
> *<fail message="mail component tests failed!">
> </fail>*
> </tasks>
> </configuration>
> </execution>
>
> <execution>
> <id>stop-container</id>
> <phase>post-integration-test</phase>
> <goals>
> <goal>run</goal>
> </goals>
> <configuration>
> <tasks description="container: STOPPING">
> <echo message="================================" />
> <echo message="= STOPPING container... =" />
> <echo message="================================" />
>                                        [...]
> </tasks>
> </configuration>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
> [...]
> </project>
>
> Thanks.
>
> --
> Mathieu
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to