NUnit 和 Selenium - 降低 4 个可并行 WebDriver 的默认数量
NUnit & Selenium - lowering default amount of 4 parallelizable WebDrivers
所以目前我有很多测试都标有 Parallelizable 以利用 NUnits 并行 运行 selenium webdriver 测试的能力。
默认数量似乎是 4,但是我想减少这个数量以增加稳定性。
有谁知道如何减少这个默认金额?我似乎找不到任何有关如何在线执行此操作的信息。
我希望有一个简单的方法可以使用 nunit 控制台 运行ner 来做到这一点。比如参数什么的
这可以实现,使用LevelOfParallelism Attribute
。来自 documentation
This is an assembly-level attribute, which may be used to specify the level of parallelism, that is, the maximum number of worker threads executing tests in the assembly. It may be overridden using a command-line option in the console runner.
此属性是可选的。如果未指定,NUnit 使用处理器数或 2,以较大者为准。例如,在四处理器机器上默认值为 4。
例子
以下代码可能会放在 AssemblyInfo.cs 中,将并行度设置为 3:
[assembly:LevelOfParallelism(3)]
平台支持
桌面 .NET 运行时上的 NUnit 框架支持并行执行。目前我们的便携式或 .NET Standard 构建不支持它,尽管可以无错误地识别属性以允许在针对多个目标构建的项目中使用。
文档:https://docs.nunit.org/articles/nunit/writing-tests/attributes/levelofparallelism.html
所以目前我有很多测试都标有 Parallelizable 以利用 NUnits 并行 运行 selenium webdriver 测试的能力。
默认数量似乎是 4,但是我想减少这个数量以增加稳定性。
有谁知道如何减少这个默认金额?我似乎找不到任何有关如何在线执行此操作的信息。
我希望有一个简单的方法可以使用 nunit 控制台 运行ner 来做到这一点。比如参数什么的
这可以实现,使用LevelOfParallelism Attribute
。来自 documentation
This is an assembly-level attribute, which may be used to specify the level of parallelism, that is, the maximum number of worker threads executing tests in the assembly. It may be overridden using a command-line option in the console runner.
此属性是可选的。如果未指定,NUnit 使用处理器数或 2,以较大者为准。例如,在四处理器机器上默认值为 4。
例子 以下代码可能会放在 AssemblyInfo.cs 中,将并行度设置为 3:
[assembly:LevelOfParallelism(3)]
平台支持 桌面 .NET 运行时上的 NUnit 框架支持并行执行。目前我们的便携式或 .NET Standard 构建不支持它,尽管可以无错误地识别属性以允许在针对多个目标构建的项目中使用。
文档:https://docs.nunit.org/articles/nunit/writing-tests/attributes/levelofparallelism.html