Question

First off, I suspect this isn't going to be easy, because there isn't an entry for calabash-android in the Maven central repository and the calabash-android project doesn't provide one.

That being said, does anyone know how to manage calabash-android tests during a Maven build? Are there any plugins for this? I can't find any, but in the off chance my google-fu has failed me or there's a workaround... I'd love to hear about it.

[edit] I'm using the maven-android plugin for the apk build.

Was it helpful?

Solution

I am assuming you are familiar with the Android Maven plugin? If not, you should check it out. Here is a method that is not bulletproof, but should work:

1- Start by writing a shell script that launches the Calabash tests. This shell script, say calabash.sh, wouldn't be too complicated, just something along the lines of:

calabash-android run ../target/<app>.apk /path/to/calabash/tests

2- Launch this script once maven has finished its integration-test phase (if you are using Android Maven, that's when you run your unit tests). This is taken from this SO question:

<plugin>
  <artifactId>exec-maven-plugin</artifactId>
  <groupId>org.codehaus.mojo</groupId>
  <executions>
    <execution>
      <id>Version Calculation</id>
      <phase>validate</phase> //This occurs [after integration-test][3]
      <goals>
        <goal>exec</goal>
      </goals>
      <configuration>
        <executable>${basedir}/scripts/calabash.sh</executable>
      </configuration>
    </execution>
  </executions>
</plugin>

This is not a bulletproof solution because I suspect that Maven cannot report any calabash test failures. Also, you might need to add some bash magic to make the script run until completion before Maven finishes building.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top