2017-08-08 61 views

回答

2

在做了一些研究后,我发现在这个和类似的问题上有几张门票。也许下面会提供更多信息。

目前,为cucumber-jvm发行版本1.2.5,功能作为单个TestNG的试运行(您可以在下面的图片中看到)

enter image description here

ticket开着,不久前和他们添加了为每个场景运行TestNG测试的功能(请求here)。

由于这些变化都尚未公布,为了得到TestNG的为每个场景中运行,你所要做的几件事情:

  • 项目用来测试这个->here。 (我在这个项目中使用了IntelliJ,在Eclipse中也可以做同样的事情)
  • 更新pom.xml所以你可以使用master分支cucumber-jmv,因此有最新的变化。以下是我所做的更改。

<repositories> 
    <repository> 
     <id>sonatype-snapshots</id> 
     <url>https://oss.sonatype.org/content/repositories/snapshots</url> 
     <snapshots> 
      <enabled>true</enabled> 
     </snapshots> 
    </repository> 
</repositories> 

<parent> 
    <groupId>io.cucumber</groupId> 
    <artifactId>cucumber-jvm</artifactId> 
    <version>2.0.0-SNAPSHOT</version> 
</parent> 

<artifactId>java-calculator-testng</artifactId> 
<packaging>jar</packaging> 
<name>Examples: Java Calculator TestNG</name> 

<dependencies> 
    <dependency> 
     <groupId>info.cukes</groupId> 
     <artifactId>cucumber-jvm-deps</artifactId> 
     <version>1.0.5</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>io.cucumber</groupId> 
     <artifactId>cucumber-java</artifactId> 
     <version>2.0.0-SNAPSHOT</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>io.cucumber</groupId> 
     <artifactId>cucumber-testng</artifactId> 
     <version>2.0.0-SNAPSHOT</version> 
     <scope>compile</scope> 
     <exclusions> 
      <exclusion> 
       <groupId>junit</groupId> 
       <artifactId>junit</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
</dependencies> 

  • src/test/java,开放RunCukesTest并运行它。下面是结果:

enter image description here

我敢肯定,你可以将testng.xml,使其运行如你所愿。

不幸的是,现在,steps仍然没有显示。可能会在未来的版本中添加,这是下一个逻辑步骤。

希望这回答你的问题。

+0

我已经提到嵌入式github项目本身来设置TestNG +黄瓜。但即使在根据您的建议提及课程名称后,结果并不会显示每个步骤。请让我知道它是否在你的最后? – vikramvi

+0

感谢这个信息,是不是应该问题为TestNG github回购而不是cucumber-jvm?我看着票但它不谈论这个特别的问题 – vikramvi

+0

我继续并提出问题https://github.com/cbeust/testng-eclipse/issues/350 – vikramvi