【问题标题】:Cucumber tags: Type mismatch: cannot convert from String[] to String黄瓜标签:类型不匹配:无法从 String[] 转换为 String
【发布时间】:2020-09-04 13:22:14
【问题描述】:

@CucumberOptions 下,使用tags 选项仅执行一组测试,例如:冒烟测试。我已经编写了如下所述的标签代码:

@CucumberOptions(
        tags = {"@SmokeTest"} // <<< Type mismatch: cannot convert from String[] to String
        )

但我收到类型不匹配错误。

【问题讨论】:

  • 您不应该将图像用于文本。它们在某些设备上难以阅读,也无法搜索。
  • 问题中的图像文本是显示错误的更好方式。您是在谈论“答案”屏幕截图吗?我会更新我的答案,谢谢
  • 不。无法在手机或屏幕阅读器上阅读图像。您也可以应用一些 ASCII 艺术来明确错误的位置。
  • 感谢您的信息。今后我也会如此。

标签: cucumber


【解决方案1】:

要解决此问题,请勿对标签使用花括号。只需为以下代码编写代码

@CucumberOptions(
        tags = "@SmokeTest and @End2End"
        )

删除花括号后我没有收到任何错误。

【讨论】:

  • 如果我的功能文件中总共有 7 个标签。在 runner 类中很难写出它们的关系。例如。 "@Smoke not @Sanity and @Chrome or @Firefox and @qa not @stage" 另外,每次我想更改关系时,我都需要提交 Runner 类。有没有办法从终端的命令行中做到这一点。
  • 没用,过滤器命令没有捡起来
  • @paul 使用,mvn test -Dcucumber.filter.tags="(@cucumber or @gherkin) 而不是@salad"
猜你喜欢
  • 1970-01-01
  • 2019-09-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-11-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多