我是黄瓜的新手。我正在尝试在 maven 项目中使用 testng 运行黄瓜功能文件。为此,在我的 pom.xml 文件中,我依赖于 TestNG、cucumber、junit、cucumber junit、cucumber java、selenium java
我已经CucumberOptions从io.cucumber.junit.CucumberOptions并且当我使用属性格式时,eclipse 抛出错误该格式注释类型 CucumberOptions 的属性格式未定义
此外 eclipse 还为我提供了从 3 个不同类导入 CucumberOptions 的选项,即
io.cucumber.junit.CucumberOptions
io.cucumber.testng.CucumberOptions
cucumber.api.CucumberOptions
I have 2 questions.
Run Code Online (Sandbox Code Playgroud)
所有这 3 个包似乎都不支持格式属性,如果我想在 o/p 以下,我该怎么办
format = {
"pretty",
"html:target/cucumber-reports/cucumber-pretty",
"json:target/cucumber-reports/CucumberTestReport.json",
"rerun:target/cucumber-reports/rerun.txt"
}
Run Code Online (Sandbox Code Playgroud)我完全不知道什么时候将这些包中的每一个用于什么场景。请帮我。
尝试谷歌搜索信息,很少有博客说格式已被弃用,现在我们需要使用漂亮的,同时很少有人说我们应该使用格式来生成不同格式的输出
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 {}
Run Code Online (Sandbox Code Playgroud)
期望:想知道我什么时候应该使用哪个导入还想知道我应该怎么做才能在 html、json 中获取报告,返回 TestRunner 文件中提到的格式