io.cucumber.junit.CucumberOptions vs io.cucumber.testng.CucumberOptions vs cucumber.api.CucumberOptions 我应该选择哪个
io.cucumber.junit.CucumberOptions vs io.cucumber.testng.CucumberOptions vs cucumber.api.CucumberOptions which one should i choose
我是 cucumber.I 的新手,正在尝试 运行 在 Maven 项目中使用 testng 的黄瓜功能文件。为此,在我的 pom.xml 文件中,我有
TestNG、黄瓜、junit、黄瓜 junit、黄瓜 java、硒 java
我已经从 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.
这3个包好像都不支持format属性,what
我应该怎么做,如果我想要低于 o/p
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 文件中提到的格式
I am new to cucumber.
看看 https://cucumber.io/docs/guides/10-minute-tutorial/
I am trying to run cucumber feature files using testng in maven project. for which, in my pom.xml file, I have dependencies for TestNG,cucumber,junit,cucumber junit,cucumber java,selenium java
每个依赖项都提供一些功能。您应该只为您需要的位添加依赖项。例如 cucumber-java
依赖项为您提供 @Given
、@When
、@Then
注释。 cucumber-junit
和 cucumber-testng
模块分别提供与 JUnit 和 TestNG 的集成。
您不太可能同时使用两者。因此,如果您使用 TestNG 进行测试,您应该使用 cucumber-testng
和 cucumber-java
并移除对 cucumber-junit
的依赖。相反,如果您使用 JUnit 进行测试,则应使用 cucumber-junit
和 cucumber-java
并删除 cucumber-testng
.
Want to know when should i use which import
您的 IDE 应该告诉您 cucumber.api.CucumberOptions
已弃用。因此,如果您使用 JUnit,则使用 io.cucumber.junit.CucumberOptions
,如果使用 TestNG,则使用 io.cucumber.testng.CucumberOptions
.
All these 3 packages seems do not support format attribute
format
属性已替换为 plugin
。
现在我无法确定您使用的是 JUnit 还是 TestNG,所以您必须选择:
我是 cucumber.I 的新手,正在尝试 运行 在 Maven 项目中使用 testng 的黄瓜功能文件。为此,在我的 pom.xml 文件中,我有 TestNG、黄瓜、junit、黄瓜 junit、黄瓜 java、硒 java
我已经从 io.cucumber.junit.CucumberOptions
导入了 CucumberOptions
并且当我使用属性格式时,eclipse 抛出错误格式 属性格式未定义注释类型 CucumberOptions
eclipse 还为我提供了从 3 个不同的 类 即
io.cucumber.junit.CucumberOptions
io.cucumber.testng.CucumberOptions
cucumber.api.CucumberOptions
I have 2 questions.
这3个包好像都不支持format属性,what 我应该怎么做,如果我想要低于 o/p
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 文件中提到的格式
I am new to cucumber.
看看 https://cucumber.io/docs/guides/10-minute-tutorial/
I am trying to run cucumber feature files using testng in maven project. for which, in my pom.xml file, I have dependencies for TestNG,cucumber,junit,cucumber junit,cucumber java,selenium java
每个依赖项都提供一些功能。您应该只为您需要的位添加依赖项。例如 cucumber-java
依赖项为您提供 @Given
、@When
、@Then
注释。 cucumber-junit
和 cucumber-testng
模块分别提供与 JUnit 和 TestNG 的集成。
您不太可能同时使用两者。因此,如果您使用 TestNG 进行测试,您应该使用 cucumber-testng
和 cucumber-java
并移除对 cucumber-junit
的依赖。相反,如果您使用 JUnit 进行测试,则应使用 cucumber-junit
和 cucumber-java
并删除 cucumber-testng
.
Want to know when should i use which import
您的 IDE 应该告诉您 cucumber.api.CucumberOptions
已弃用。因此,如果您使用 JUnit,则使用 io.cucumber.junit.CucumberOptions
,如果使用 TestNG,则使用 io.cucumber.testng.CucumberOptions
.
All these 3 packages seems do not support format attribute
format
属性已替换为 plugin
。
现在我无法确定您使用的是 JUnit 还是 TestNG,所以您必须选择: