[英]Karate force scenarios inside a feature file to execute sequentially on multiple threads
When running all of my feature files, through bamboo/maven, using the "clean test" command, how do I force the scenarios inside each feature file to run in order?当通过竹子/Maven运行我的所有功能文件时,使用“clean test”命令,我如何强制每个功能文件中的场景按顺序运行? On multiple threads.
在多个线程上。 For example, if I have 100 feature files, with 20 scenarios in each feature file, when I run them on with 5 threads, the order of the feature files doesn't matter, feature 10 can run before feature 15, but the scenarios inside of each feature have to run in sequential order.
例如,如果我有 100 个功能文件,每个功能文件中有 20 个场景,当我用 5 个线程运行它们时,功能文件的顺序无关紧要,功能 10 可以在功能 15 之前运行,但里面的场景每个功能必须按顺序运行。 I need to run feature 10 scenario 1, then feature 10 scenario 2, and so on.
我需要运行功能 10 场景 1,然后功能 10 场景 2,依此类推。
So with 5 threads:所以有5个线程:
thread 1 can run feature 1线程 1 可以运行功能 1
thread 2 can run feature 10线程 2 可以运行功能 10
thread 3 can run feature 3线程 3 可以运行功能 3
thread 4 can run feature 2线程 4 可以运行功能 2
thread 5 can run feature 4线程 5 可以运行功能 4
But I need each scenario 1 through 20, to execute in order.但我需要每个场景 1 到 20,按顺序执行。
So with 5 threads:所以有5个线程:
thread 1 feature 1 scenario 1, then scenario 2, then scenario 3, ext.线程 1 功能 1 场景 1,然后是场景 2,然后是场景 3,ext。
thread 2 feature 10 scenario 1, then scenario 2, then scenario 3, ext.线程 2 功能 10 场景 1,然后是场景 2,然后是场景 3,ext。
thread 3 feature 3 scenario 1, then scenario 2, then scenario 3, ext.线程 3 功能 3 场景 1,然后是场景 2,然后是场景 3,ext。
thread 4 feature 2 scenario 1, then scenario 2, then scenario 3, ext.线程 4 功能 2 场景 1,然后是场景 2,然后是场景 3,分机。
thread 5 feature 4 scenario 1, then scenario 2, then scenario 3, ext.线程 5 功能 4 场景 1,然后是场景 2,然后是场景 3,ext。
Is @parallel=false the answer? @parallel=false 是答案吗? Do I really need to add that to the top of every single feature file.
我真的需要将它添加到每个功能文件的顶部吗? Like I said I could have 100 feature files in my repository, maybe more.
就像我说的那样,我的存储库中可以有 100 个功能文件,也许更多。 Or do I have to add @parallel=false on the command line?
或者我必须在命令行上添加 @parallel=false 吗? If so, would it be like the other options, "-Dparallel=false"?
如果是这样,它会像其他选项一样,“-Dparallel=false”吗?
If your Scenario
-s are written so that they depend on each other, this is a bad-practice.如果您的
Scenario
-s 被编写成它们相互依赖,那么这是一种不好的做法。 Please read: https://stackoverflow.com/a/46080568/143475 very carefully.请仔细阅读: https://stackoverflow.com/a/46080568/143475 。
So yes, Karate does not support a "global" switch to enable the behavior you describe.所以是的,空手道不支持“全局”开关来启用您描述的行为。 And one of the reasons is to discourage bad practices.
原因之一是阻止不良做法。
You will have to add @parallel=false
for all features.您必须为所有功能添加
@parallel=false
。 Even this may not have the desired effect you want in the 1.0 version, because of some behavior changes: https://github.com/intuit/karate/wiki/1.0-upgrade-guide即使这可能在 1.0 版本中也没有您想要的效果,因为一些行为更改: https://github.com/intuit/karate/wiki/1.0-upgrade-guide
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.