2012-11-27 24 views
0

我已经使用Jbehave编写测试用例,我使用Junit运行它,现在我需要将它转换为Maven目标。如何将Jbehave测试转换为Maven目标?

怎么办?

我应该在pom.xml中添加哪些行才能使其工作?

编辑:

如何运行它作为Maven的目标是什么命令,我应该使用?

我,如果我在Eclipse中单独使用JUnit运行它运行正确的测试...然后我
添加按照pom.xml的行

<plugin> 

<groupId>org.jbehave</groupId> 

<artifactId>jbehave-maven-plugin</artifactId> 

<executions> 
<execution> 

    <id>run-scenarios</id> 

    <phase>integration-test</phase> 

    <configuration> 
    <scenarioIncludes> 

     <scenarioInclude>**/*Story.java</scenarioInclude> 

    </scenarioIncludes> 
    <ignoreFailureInStories>true</ignoreFailureInStories> 
    <ignoreFailureInView>false</ignoreFailureInView> 
    <outputDirectory> ${project.build.directory}/jbehave/view</outputDirectory> 
    </configuration> 

    <goals> 
    <goal>run-scenarios</goal> 

    </goals> 
    </execution> 

    </executions> 
    </plugin> 

,并尝试运行的pom.xml作为“ Maven包“,通过右键点击Pom.xml ...但它不显示甚至没有任何错误/失败..精确地说,没有指出我在pom.xml中引用的测试...

我有什么错过了什么?

我怎么知道测试是否运行?

回答

1

如果它只是一个JUnit,您可以直接使用Maven,因为maven-surefire-plugin将运行单元测试。但是docs about JBehave显示了jbehave-maven-plugin的例子。