You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Gaurav Arora <g....@iontrading.com> on 2012/02/14 12:20:48 UTC

Make plugin failsafe compatible

Hi,

I'm running robot framework tests from maven using the rf maven plugin -
http://code.google.com/p/robotframework-maven-plugin/. The plugin works
fine except that it fails my build and prevents post-integration-test from
running and post-integration-test is where I tear down my environment.

This is how the failsafe plugin is configured.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-failsafe-plugin</artifactId>
<version>2.12</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>

And this is how I run the rf plugin.
<plugin>
<groupId>com.googlecode.robotframework-maven-plugin</groupId>
 <artifactId>robotframework-maven-plugin</artifactId>
<version>1.1.2-SNAPSHOT</version>
 <executions>
<execution>
<phase>integration-test</phase>
 <goals>
<goal>run</goal>
</goals>
 </execution>
</executions>
</plugin>

I can clearly see in the logs that the failsafe plugin is run but for some
reason the rf plugin bypasses the failsafe plugin. This makes me think that
I need to change the rf plugin to be failsafe compatible. Am I right or
completely off the mark?

Thanks,
Gaurav

P.S. The rf plugin throws a MojoExecutionException when there are test
failures.

Re: Make plugin failsafe compatible

Posted by Stephen Connolly <st...@gmail.com>.
On 14 February 2012 11:20, Gaurav Arora <g....@iontrading.com> wrote:
> Hi,
>
> I'm running robot framework tests from maven using the rf maven plugin -
> http://code.google.com/p/robotframework-maven-plugin/. The plugin works
> fine except that it fails my build and prevents post-integration-test from
> running and post-integration-test is where I tear down my environment.
>
> This is how the failsafe plugin is configured.
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
>  <artifactId>maven-failsafe-plugin</artifactId>
> <version>2.12</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>
>
> And this is how I run the rf plugin.
> <plugin>
> <groupId>com.googlecode.robotframework-maven-plugin</groupId>
>  <artifactId>robotframework-maven-plugin</artifactId>
> <version>1.1.2-SNAPSHOT</version>
>  <executions>
> <execution>
> <phase>integration-test</phase>
>  <goals>
> <goal>run</goal>
> </goals>
>  </execution>
> </executions>
> </plugin>
>
> I can clearly see in the logs that the failsafe plugin is run but for some
> reason the rf plugin bypasses the failsafe plugin. This makes me think that
> I need to change the rf plugin to be failsafe compatible. Am I right or
> completely off the mark?

actually you need to change it to be integration-test compatible...

>
> Thanks,
> Gaurav
>
> P.S. The rf plugin throws a MojoExecutionException when there are test
> failures.

Well what you really should do, if you are executing a goal that is
bound to the "integration-test" phase is *never fail the build* but
offer a second goal (bound to the "verify" phase) that checks the
results of your "integration-test" phase goal and fails the build if
necessary.

That is how integration tests are supposed to work... see both the
failsafe and invoker plugins for examples of this.

In short, if your goal is bound to the "integration-test" phase then
you should not fail the build *ever* otherwise the
"post-integration-test" phase never gets executed to do whatever
tidy-up is needed in the user's build...

Oh and while I am at it, *never* invoke the "integration-test" phase directly

mvn integration-test <---- BAD BAD BAD

mvn verify <---- GOOD

Again this is for the same reason

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org