Cucumber新手,记录遇到的问题
1. 遇到的错误
Exception in thread "main" cucumber.runtime.CucumberException: You're not allowed to extend classes that define Step Definitions or hooks. class A extends class B
原因:在类B中使用了cucumber的@before,去掉即可
2 cucumber入口类中CucumberOptions,tags参数的配置
在cucumber的入口类,cucumberOptions参数中的tags可以指定执行哪些特定标签的场景
@CucumberOptions( tags="", plugin = {"pretty", "json:target/report.json"}, strict = true, monochrome = true)
旧版本标签的配置如下
tags = {"@st"}, 表示只执行有@st标记的scenario
tags = {"@st","@dt"}, 表示只执行同时含有@st和@dt标记的scenario
tags = {"@st","~@dt"}, 表示执行有@st标记的同时排除标记有@dt标记的scenario
tags = {"@st,@dt"}, 表示执行有@st和@dt标记的scenario
新版本做了改动
tags = "(@st or @ft) and not @dt" ,表示执行带有@st或@ft,同时排除标记有@dt标记的scenario
这里是对应的changelog
https://github.com/cucumber/cucumber-jvm/blob/main/CHANGELOG.md
https://github.com/cucumber/cucumber-jvm/pull/1955