运行 一个空手道场景

Run a single scenario in karate

要测试空手道 i 中的特定功能 运行 此命令:

mvn test -Dkarate.options="classpath:myfeature.feature"

有办法运行将单个场景定义为功能吗?

谢谢, 洛伦佐

是的,您可以通过标签:https://github.com/intuit/karate#tags

另请注意,您可以按名称 运行 场景,例如如果名称是“first”:

mvn test -Dkarate.options="classpath:myfeature.feature --name ^first$" 

如果您使用 IntelliJ - 您可以右键单击并执行上述操作。

编辑:空手道现在支持使用行号,例如some.feature:42 因此它将仅调用第 42 行的 Scenario 或大纲 Example - 这仅适用于 IDE-s 和开发人员模式,使用标签以实现可维护性。