How to specify a single scenario with jar file?

为君一笑 提交于 2019-12-10 23:36:35

问题


I am trying to follow this post to run a specific scenario and I am failing at doing this when running the stand-alone version (v0.9.1).

My experiments:

(1) java -Dkarate.options="--name ^bla$" -jar karate.jar features/many.feature

It runs all scenarios from the feature file.

(2) java -Dkarate.options="classpath:features/many.feature --name ^bla$" -jar karate.jar

starts the UI without executing a test case.

What am I missing here?


回答1:


using tags will be a convenient way for this

add a different tag before each scenario and pass the tag name with -t while calling with karate standalone

many.feature

Feature: Many scenario
 @s1
 Scenario: SOne
   * print 'first scenario'
 @s2
 Scenario: Stwo
   * print 'second scenario'

Now pass the scenario tag like,

java -jar karate.jar many.feature -t @s1


来源:https://stackoverflow.com/questions/55278417/how-to-specify-a-single-scenario-with-jar-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!