我面临与黄瓜标签和Junit设置相关的问题,因为旧的和最新的黄瓜之间存在差异。
在第一种情况下@Given,@ When,@Then标签工作正常,但在Junit设置中面临Cucumber.class和Cucumber.Options()的问题。
在第二种情况下,CucumberOptions(..)(在最新版本中更新了一次)工作正常,但问题是@Given,@ When,@Then。
有人可以提供与jar版本相关的正确的Cucumber标签和JUnit设置。
案例1: 的 的pom.xml
<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:
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(plugin={"pretty","html:reports/test-report"},tags= "@Smoketest")
public class JunitRunner {
}
案例2: pom.xml
<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
@RunWith(Cucumber.class)
@CucumberOptions(plugin={"pretty","html:reports/test-report"},tags= "@Smoketest")
public class JunitRunner {
}
并且1.2.2面临Cucumber标签问题,如下所示:
答案 0 :(得分:0)
您应该使用这些导入---
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;