Reputation: 1102
I have a series of JBehave tests that I run from the command line via
mvn integration-test
I am trying to decorate a subset of tests with a meta tag SpecialPurpose
, which only get run on-demand:
Meta:
@SpecialPurpose
Scenario: Run this test only from the nightly build
Following Filtering with multiple metafilters in JBehave, I try the following command line:
mvn integration-test -Djbehave.meta.filter="myCustomRunConf:(+SpecialPurpose)"
This runs all the tests in the suite. For completeness, I also tried
mvn integration-test -Djbehave.meta.filter="+SpecialPurpose"
and
mvn integration-test -Dmeta.filter="+SpecialPurpose"
as described at https://kowalcj0.wordpress.com/2013/01/22/how-to-selectively-run-in-jbehave-stories-tagged-with-multiple-words-in-a-meta-field/. None of these appear to successfully filter.
And for completeness, the pom.xml segment related to JBehave is
<build>
<plugins>
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>serenity-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**/integration/*.java</include>
<include>**/integration/component1/*.java</include>
<include>**/integration/component2/*.java</include>
<include>**/integration/component3/*.java</include>
</includes>
<reuseForks>false</reuseForks>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
</plugins>
</build>
1) What is the proper syntax for decorating a story for inclusion?
2) What is the proper command-line?
3) Is there something unusual with the pom.xml definition that is intercepting or breaking the metafilter?
Upvotes: 1
Views: 2814
Reputation: 338
To handle the real features of Jbehave, use jbehave-maven-plugin in maven. To run the test configure maven jbehave plugin as below.
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>4.0</version>
<executions>
<execution>
<id>run-stories-as-embeddables</id>
<phase>test</phase>
<configuration>
<scope>test</scope>
<testSourceDirectory>${basedir}/src/main/java/</testSourceDirectory>
<testClassesDirectory>${project.build.directory}/classes/</testClassesDirectory>
<includes>
<include>**/integration/*.java</include>
<include>**/integration/component1/*.java</include>
<include>**/integration/component2/*.java</include>
<include>**/integration/component3/*.java</include>
</includes>
<threads>1</threads>
<metaFilters>
<metaFilter>${meta.filter}</metaFilter>
</metaFilters>
</configuration>
<goals>
<goal>integration-test</goal>
<goal>run-stories-as-embeddables</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>compile</scope>
</dependency>
</dependencies>
In the run time use
mvn integration-test -Dmeta.filter="+SpecialPurpose"
Upvotes: 1