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我应该选择哪一个,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的选项,即

我是cucumber的新手。我正在尝试在maven项目中使用testng运行cucumber特性文件。在我的pom.xml文件中,我有 TestNG,黄瓜,junit,黄瓜junit,黄瓜爪哇,硒爪哇

我已经从
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个包似乎都不支持格式属性,什么 如果我想要低于o/p,我应该这样做吗

    format = {
    "pretty",
    "html:target/cucumber-reports/cucumber-pretty",
    "json:target/cucumber-reports/CucumberTestReport.json",
    "rerun:target/cucumber-reports/rerun.txt"
    } 
    
  • 我完全不知道什么时候该用这些软件包做什么 脚本请帮帮我

  • 尝试用谷歌搜索信息,很少有博客说格式不受欢迎,现在我们需要使用pretty,同时也很少有人说我们应该使用格式生成不同格式的输出

    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,如果使用TestNG
    io.Cumber.TestNG.CumberOptions

    这3个包似乎都不支持格式属性

    格式
    属性被替换为
    插件

    现在我无法确定您使用的是JUnit还是TestNG,因此您必须选择: