Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/353.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法从mvn命令行使JBehave元筛选器工作_Java_Maven_Jbehave - Fatal编程技术网

Java 无法从mvn命令行使JBehave元筛选器工作

Java 无法从mvn命令行使JBehave元筛选器工作,java,maven,jbehave,Java,Maven,Jbehave,我有一系列JBehave测试,我通过 mvn integration-test 我正试图用一个meta标记SpecialPurpose来修饰测试的子集,该标记只能按需运行: Meta: @SpecialPurpose Scenario: Run this test only from the nightly build 下面,我尝试以下命令行: mvn integration-test -Djbehave.meta.filter="myCustomRunConf:(+SpecialPurp

我有一系列JBehave测试,我通过

mvn integration-test
我正试图用一个meta标记
SpecialPurpose
来修饰测试的子集,该标记只能按需运行:

Meta:
@SpecialPurpose

Scenario: Run this test only from the nightly build
下面,我尝试以下命令行:

mvn integration-test -Djbehave.meta.filter="myCustomRunConf:(+SpecialPurpose)"
这将运行套件中的所有测试。为了完整性,我也尝试了

mvn integration-test -Djbehave.meta.filter="+SpecialPurpose"

如中所述。所有这些似乎都无法成功过滤

为完整起见,与JBehave相关的pom.xml段是

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

net.serenity-bdd.maven.plugins
serenity maven插件
1.5.0
宁静报道
整合后测试
总数的
org.apache.maven.plugins
maven故障保护插件
集成测试
集成测试
验证
**/集成/*.java
**/集成/组件1/*.java
**/集成/组件2/*.java
**/集成/组件3/*.java
假的
假的
1) 修饰故事以供包含的正确语法是什么

2) 什么是正确的命令行


3) pom.xml定义是否有什么不寻常的地方正在拦截或破坏元过滤器?

要处理Jbehave的真正功能,请在maven中使用Jbehave maven插件。要运行测试,请按如下所示配置maven jbehave插件

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

根据中的示例,正确的参数似乎是-Dmeta.filter
<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>
mvn integration-test -Dmeta.filter="+SpecialPurpose"