杰贝弗Maven-如何跳过场景测试 [英] JBehave & Maven - how to skip scenario tests

查看:101
本文介绍了杰贝弗Maven-如何跳过场景测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jbehave和jbehave maven插件来运行一组场景测试.

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

让我的测试类扩展JUnitStories,一切正常.唯一的问题是,我无法停止运行测试...

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

每次我运行maven安装目标时,它都会运行测试. 我尝试在下面添加跳过场景配置文件,但它不会阻止测试的运行.

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>

我也尝试过使用exclude标签而不是skip,并排除我的场景类,但是没有运气.

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!

推荐答案

您不需要配置文件.只需将$ {skipTests}添加到这样的执行配置中

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>
            ...

运行mvn -DskipTests将跳过单元测试和JBhehave方案.

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

这篇关于杰贝弗Maven-如何跳过场景测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆