我正在尝试在我的 Cucumber runner 中使用标签,但没有用。我是黄瓜的新手

I am trying use tag in my Cucumber runner but doesn't work. I am new to Cucumber

Please see the screenshot我正在尝试 运行 我的黄瓜 运行ner 使用黄瓜选项并尝试使用标签,但它不起作用。

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(
        dryRun = false,
        strict = true,
        monochrome = true,
        features = {"src/test/resources/"},
        glue = {"com.learning"},
        plugin = {"pretty",
                "html:target/site/cucumber-html",
                "json:target/cucumber1.json"},
        tags = {"@BookingFlight"}
)
public class MyRunner {

}

Error is: java: annotation value not of an allowable type[enter image description here][1]


  [1]: https://i.stack.imgur.com/P6OuL.png

您必须删除标签属性中的大括号:

@RunWith(Cucumber.class)
@CucumberOptions(
        dryRun = false,
        strict = true,
        monochrome = true,
        features = {"src/test/resources/"},
        glue = {"com.learning"},
        plugin = {"pretty",
                "html:target/site/cucumber-html",
                "json:target/cucumber1.json"},
        tags = "@BookingFlight"
)
public class MyRunner {

}

您可以在一个字符串中指定多个标签,即:“@BookingFlight 或@BookingGeneral”