简体   繁体   English

NUnit 测试未并行运行

[英]NUnit tests not running in parallel

I have a situation where I want to run tests in parallel using NUnit我有一种情况,我想使用 NUnit 并行运行测试

To do this I use the attributes below为此,我使用以下属性

 [Parallelizable(ParallelScope.All)]
 [FixtureLifeCycle(LifeCycle.InstancePerTestCase)]
 [TestFixture] 
 public class MyTestFixture
 {
     [Test]
     public void Test1()
     {

     }
     
     [Test] 
     public void Test2()
     {

     }
  }
}

In my actual scenario I have over 200 tests in a fixture在我的实际场景中,我在一个夹具中有超过 200 个测试

Watching the test explorer in Visual Studio the tests dont appear to be run in parallel在 Visual Studio 中观看测试资源管理器,测试似乎没有并行运行

The same applies when running the tests via NUnit Lite通过 NUnit Lite 运行测试时也是如此

Is there a way of just running this test fixture via the command line to see if its an issue with the runners?有没有办法通过命令行运行这个测试夹具,看看它是否是跑步者的问题?

What am I doing wrong?我究竟做错了什么?

Paul保罗

If you want to run NUnit tests in parallel, you can use the Parallelizable attribute over the test cases.如果要并行运行 NUnit 测试,可以在测试用例上使用Parallelizable属性。

NUnit 3 offers a Parallelizable attribute, which can be used to denote which tests can be run in parallel NUnit 3 提供了一个Parallelizable属性,可以用来表示哪些测试可以并行运行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM