首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Cucumber标记(给定,何时,然后)和JUnit(Cucumber.class,Cucumber.Options(..))面临的问题最新老黄瓜

Cucumber标记(给定,何时,然后)和JUnit(Cucumber.class,Cucumber.Options(..))面临的问题最新老黄瓜
EN

Stack Overflow用户
提问于 2016-11-14 15:44:03
回答 1查看 321关注 0票数 1

我面临一个与黄瓜标签和Junit设置有关的问题,因为老黄瓜和最新黄瓜之间存在差异。

  1. 我使用的是黄瓜1.0.2 jar和Cucumber.Options(.)
  2. 我使用的是黄瓜1.2.2jar和CucumberOptions(..)

在第一种情况下,@ facing,@When,@标记工作正常,但在Junit安装程序中,Cucumber.class和Cucumber.Options()会遇到问题。

第二种情况是CucumberOptions(..)(最新版本的更新版)工作正常,但与“Given”、“时间”、“然后”不一致。

请有人提供正确的黄瓜标签和JUnit设置有关的jar版本。

案例1:pom.xml

代码语言:javascript
复制
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>1.0.2</version>
    <scope>test</scope>
</dependency>
<dependency> 
    <groupId>info.cukes</groupId> 
    <artifactId>cucumber-junit</artifactId> 
    <version>1.0.2</version> 
    <scope>test</scope> 
</dependency>  
<dependency> 
    <groupId>junit</groupId> 
    <artifactId>junit</artifactId> 
    <version>4.10</version> 
    <scope>test</scope> 
</dependency>

Junit Runner:

代码语言:javascript
复制
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(plugin={"pretty","html:reports/test-report"},tags= "@Smoketest")
public class JunitRunner {

}

Case2:pom.xml

代码语言:javascript
复制
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>1.2.2</version>
    <scope>test</scope>
 </dependency>
 <dependency> 
    <groupId>info.cukes</groupId> 
    <artifactId>cucumber-junit</artifactId> 
    <version>1.2.2</version> 
    <scope>test</scope> 
 </dependency>  
 <dependency> 
    <groupId>junit</groupId> 
    <artifactId>junit</artifactId> 
    <version>4.10</version> 
    <scope>test</scope> 
 </dependency>

Junit Ruuner

代码语言:javascript
复制
@RunWith(Cucumber.class)
@CucumberOptions(plugin={"pretty","html:reports/test-report"},tags= "@Smoketest")
public class JunitRunner {

}

在1.2.2中,黄瓜标签面临问题,如下所示:

EN

回答 1

Stack Overflow用户

发布于 2016-11-14 15:59:24

你应该用这些进口品--

代码语言:javascript
复制
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40592593

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档