简体   繁体   English

功能文件中的空手道强制场景在多个线程上顺序执行

[英]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.

相关问题 从具有多个场景的特征文件中返回变量 - 空手道 - Returning Variable from Feature File With Multiple Scenarios - Karate 空手道 - 如何在单个功能文件中并行运行多个场景? - Karate - how to run multiple scenarios in a single feature file parallely? 空手道:具有多个sceanrios的子功能不会在失败的情况下执行所有方案 - Karate: Sub feature with multiple sceanrios does not execute all scenarios in case of failure 空手道 API 测试 - 在同一功能文件中的不同场景中重用变量 - Karate API Testing - Reusing variables in different scenarios in the same feature file 如何使用 Karate 为单个功能文件中的场景重用断言? - How to reuse assertions for scenarios in single feature file using Karate? 在空手道的特定功能文件中的所有场景之后,如何执行相同的代码行? - How can I execute the same lines of code after all scenarios in specific feature files in Karate? 空手道中如何在for循环中调用功能文件? - How to call a feature file inside a for loop in karate? 空手道模拟服务器 - 警告 - 没有匹配的场景,尽管模拟服务器是使用 -m 选项和模拟服务器功能文件启动的 - Karate mock server - WARN - no scenarios matched, though mock server was started with -m option and mock server feature file 空手道无法在 jar 应用程序中找到功能文件 - Karate not able to find feature file inside the jar app 空手道:使用多个 url 路径调用相同的功能文件 - Karate: Call the same feature file with multiple url paths
相关标签
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM