Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JBehave & Maven - how to skip scenario tests

I'm using jbehave and the jbehave maven plugin to run a set of scenario tests.

Have my test class extending JUnitStories, and everything works nicely. Only issue is, I can't stop running the tests...

Every time I run the maven install goal, it runs the tests. I've tried adding a skip scenarios profile, below, but it doesn't stop the tests from running.

<profile>
    <id>skipScenarios</id>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>
</profile>

I've also tried using an exclude tag instead of the skip, and excluding my scenario class, but no luck.

I'd really appreciate any insight, or ideas you guys have! Thanks!

like image 750
john.harvey Avatar asked Jan 18 '23 10:01

john.harvey


1 Answers

You don't need a profile for this. Just add ${skipTests} to the configuration of the execution like this

<plugin>
   <groupId>org.jbehave</groupId>  
   <artifactId>jbehave-maven-plugin</artifactId>
   <version>${jbehave.core.version}</version>
   <executions>
      <execution>
         <id>unpack-view-resources</id>
         <phase>process-resources</phase>
         <goals>
            <goal>unpack-view-resources</goal>
         </goals>
      </execution>
      <execution>
     <id>embeddable-stories</id>
         <phase>test</phase>
         <configuration>
            <includes>
               <include>${embeddables}</include>
            </includes>
            <excludes />
            <skip>${skipTests}</skip>
            ...

Running mvn -DskipTests will then skip unit tests and JBhehave scenarios.

like image 193
Mogens Villadsen Avatar answered Jan 24 '23 23:01

Mogens Villadsen