Cucumber标记(给定、何时、然后)和JUnit(Cucumber.class、Cucumber.Options(..)以及最新和旧Cucumber都存在问题

Cucumber标记(给定、何时、然后)和JUnit(Cucumber.class、Cucumber.Options(..)以及最新和旧Cucumber都存在问题,junit,cucumber,Junit,Cucumber,我面临着一个与Cucumber标记和Junit设置相关的问题,因为老Cucumber和最新Cucumber之间存在差异 我正在使用Cucumber 1.0.2 jar和Cucumber.Options(…) 我正在使用Cucumber1.2.2罐和CucumberOptions(…) 在第一种情况下,@Given、@When、@Then标记工作正常,但Junit安装程序中Cucumber.class和Cucumber.Options()存在问题 在第二种情况下,CucumberOptions(.

我面临着一个与Cucumber标记和Junit设置相关的问题,因为老Cucumber和最新Cucumber之间存在差异

  • 我正在使用Cucumber 1.0.2 jar和Cucumber.Options(…)
  • 我正在使用Cucumber1.2.2罐和CucumberOptions(…)
  • 在第一种情况下,@Given、@When、@Then标记工作正常,但Junit安装程序中Cucumber.class和Cucumber.Options()存在问题

    在第二种情况下,CucumberOptions(..)(最新版本中的更新版本)工作正常,但存在@Given、@When、@Then问题

    有人可以提供正确的Cucumber标签和JUnit设置,关于jar版本吗

    案例1: pom.xml

    案例2:pom.xml

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


    您应该使用这些导入--


    您应该使用这些导入--


    我想你给的套餐是1.2.2的。我正确吗?如果是,Cucumber标记很好,但在使用Cucumber的JUnit runner设置中面临问题。class@RunWith(黄瓜课)。在这篇文章中,“cumber.class”是这样说的,“类不是解析为类型的”。我只是错过了导入“cumber.api.junit.cumber;”包,这不建议在鼠标悬停时导入。我认为您提供的包是针对1.2.2的。我正确吗?如果是,Cucumber标记很好,但在使用Cucumber的JUnit runner设置中面临问题。class@RunWith(黄瓜课)。在这篇文章中,“cumber.class”是这样说的,“类不是解析为类型的”。我只是错过了导入“cumber.api.junit.cumber;”包,这不建议在鼠标悬停时导入。
    <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>
    
    import org.junit.runner.RunWith;
    import cucumber.api.CucumberOptions;
    @RunWith(Cucumber.class)
    @CucumberOptions(plugin={"pretty","html:reports/test-report"},tags= "@Smoketest")
    public class JunitRunner {
    
    }
    
    <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>
    
    @RunWith(Cucumber.class)
    @CucumberOptions(plugin={"pretty","html:reports/test-report"},tags= "@Smoketest")
    public class JunitRunner {
    
    }
    
    import cucumber.api.java.en.Given;
    import cucumber.api.java.en.Then;
    import cucumber.api.java.en.When;