io.cucumber.junit.CucumberOptions vs io.cucumber.testng.CucumberOptions vs cucumber.api.CucumberOptions我应该选择哪一个
我是cucumber的新手。我正在尝试在maven项目中使用testng运行cucumber特性文件。在我的pom.xml文件中,我有 TestNG,黄瓜,junit,黄瓜junit,黄瓜爪哇,硒爪哇 我已经从io.cucumber.junit.CucumberOptions vs io.cucumber.testng.CucumberOptions vs cucumber.api.CucumberOptions我应该选择哪一个,testng,cucumber-junit,Testng,Cucumber Junit,我是cucumber的新手。我正在尝试在maven项目中使用testng运行cucumber特性文件。在我的pom.xml文件中,我有 TestNG,黄瓜,junit,黄瓜junit,黄瓜爪哇,硒爪哇 我已经从io.cucumber.junit.CucumberOptions导入了CucumberOptions,当我使用属性格式时,eclipse抛出了一个错误,即注释类型CucumberOptions的属性格式未定义 eclipse还提供了从3个不同类导入CucumberOptions的选项,即
io.cucumber.junit.CucumberOptions
导入了CucumberOptions
,当我使用属性格式时,eclipse抛出了一个错误,即注释类型CucumberOptions的属性格式未定义
eclipse还提供了从3个不同类导入CucumberOptions的选项,即
io.cucumber.junit.CucumberOptions
io.cucumber.testng.CucumberOptions
cucumber.api.CucumberOptions
I have 2 questions.
format = {
"pretty",
"html:target/cucumber-reports/cucumber-pretty",
"json:target/cucumber-reports/CucumberTestReport.json",
"rerun:target/cucumber-reports/rerun.txt"
}
package com.qa.testngcucumberrunner;
import io.cucumber.junit.CucumberOptions;
@CucumberOptions(
dryRun=false,
monochrome=true,
strict=true,
features={"./src/test/resources/com/qa/features"},
glue={"com.qa.stepdef"},
plugin={"json:target/cucumber-
reports/CucumberTestReport.json"},
format = {
"pretty",
"html:target/cucumber-reports/cucumber-pretty",
"json:target/cucumber-reports/CucumberTestReport.json",
"rerun:target/cucumber-reports/rerun.txt"
}
)
public class TestRunner {}
期望:
想知道我什么时候应该使用哪个导入
还想知道我应该怎么做才能得到html、json和return格式的报告
格式如TestRunner文件中所述
我对黄瓜不熟悉
看一看这本书
我试图在maven项目中使用testng运行cucumber特性文件。在我的pom.xml文件中,我对TestNG、cumber、junit、cumber-junit、cumber-java、selenium-java有依赖关系
每个依赖项都提供一些功能。您应该只为所需的位添加依赖项。例如,cumberjava
依赖项为您提供了@gived
,@When
,@Then
注释。cucumber-junit
和cucumber-testng
模块分别提供与junit和testng的集成
您不太可能同时使用这两种方法。因此,如果您使用TestNG进行测试,您应该使用cucumber-TestNG
和cucumber-java
并删除对cucucumber-junit
的依赖。另一种方法是,如果您使用JUnit进行测试,您应该使用cumberJUnit
和cumberJava
并删除cumberTestNG
想知道我什么时候应该使用哪个导入
IDE应该告诉您,cucumber.api.CucumberOptions
已被弃用。因此,如果您使用JUnit,则使用io.Cumber.JUnit.CumberOptions,如果使用TestNGio.Cumber.TestNG.CumberOptions
这3个包似乎都不支持格式属性
格式
属性被替换为插件
现在我无法确定您使用的是JUnit还是TestNG,因此您必须选择: