简体   繁体   English

使用Specflow和NUnit版本3在paralel中运行测试

[英]Using Specflow and NUnit version 3 to run tests in paralel

I have a project using SpecFlow and NUnit 2.6.3 as my test provider. 我有一个使用SpecFlow和NUnit 2.6.3作为我的测试提供者的项目。 Currently it is working OK but now there is the requirement to run tests in parallel, as they become more and more heavy. 目前它工作正常,但现在需要并行运行测试,因为它们变得越来越重。

Reading along, I can see that NUnit version 3 will support parallelism out of the box, but it is still in alpha. 通过阅读,我可以看到NUnit版本3将支持开箱即用的并行性,但它仍处于alpha状态。 And I am unable to run the tests generated by SpecFlow with Nunit 3.. 并且我无法使用Nunit 3运行SpecFlow生成的测试..

Does any one have an idea if it is possible to use SpecFlow and NUnit version 3 by this moment? 是否有人知道此时是否可以使用SpecFlow和NUnit版本3? Or some other approach, still using NUnit version 2.6.3 and SpecFlow for achieving parallelism? 或者其他一些方法,仍然使用NUnit版本2.6.3和SpecFlow来实现并行性?

Thanks! 谢谢!

I ran into the same situation. 我遇到了同样的情况。 I came up with a solution using Selenium Grid, the task parallel library and the DynamicObject class. 我想出了一个使用Selenium Grid,任务并行库和DynamicObject类的解决方案。 I wrote about it here http://blog.dmbcllc.com/running-selenium-in-parallel-with-any-net-unit-testing-tool/ . 我在这里写了http://blog.dmbcllc.com/running-selenium-in-parallel-with-any-net-unit-testing-tool/ (Too long to copy and paste). (复制和粘贴时间太长)。 Hope it helps. 希望能帮助到你。 As far as I know, until 3 releases, this is the best we can do. 据我所知,直到3个版本,这是我们能做的最好的。

Thanks a lot for the suggestions. 非常感谢您的建议。

I come out with own custom solution - just exploring the test dll with reflection from a custom command line app which then spawns separate OS processes each of them calling nunit-console.exe with the --include parameter specifying only a particular group of tests. 我推出了自己的自定义解决方案 - 只需使用自定义命令行应用程序的反射来探索测试dll,然后生成单独的操作系统进程,每个操作系统调用nunit-console.exe,并使用--include参数指定一组特定的测试。 This way I avoid any thread unsafely code and still achieving my goal. 这样我就可以避免任何线程不安全的代码并仍然实现我的目标。

Edit 编辑

Btw, here is my solution , I hope someone may find it useful. 顺便说一句, 这是我的解决方案 ,我希望有人可能会觉得它很有用。 Even though now there is builtin parallelism in nunit 3+, this was battle tested against thousands of specflow / selenium tests. 即使现在在nunit 3+中存在内置并行性,但这是针对数千个specflow / selenium测试的战斗测试。 It also has a nice TeamCity integration. 它还有一个很好的TeamCity集成。 I think its simple enough (3-4 classes in total) and I tried to document all the console options available in the README file 我认为它很简单(总共3-4个类),我试图记录README文件中可用的所有控制台选项

I've tested parallel test case execution at fixture level with NUnit 3.2.0. 我已经使用NUnit 3.2.0在夹具级别测试了并行测试用例执行。 As of writing, SpecFlow 2.0 does support parallelism and is working well with NUnit 3.2.0, however SpecFlow reporting engine is not able to produce HTML reports from NUnit test execution output. 在编写时,SpecFlow 2.0确实支持并行性,并且与NUnit 3.2.0配合良好,但是SpecFlow报告引擎无法从NUnit测试执行输出生成HTML报告。 The issue is being tracked here over GitHub 这个问题正在通过GitHub进行跟踪

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

相关问题 使用 Baseclass.Contrib.SpecFlow.Selenium.NUnit 在 @Browser:Firefox (C#/Specflow) 中运行测试 - Using Baseclass.Contrib.SpecFlow.Selenium.NUnit to run tests in @Browser:Firefox (C#/Specflow) 使用 Nunit3-Console.exe 运行 specflow 测试,但仅检测来自一个命名空间的测试 - Using Nunit3-Console.exe to run specflow tests but detects tests from only one namespace 使用 Webinator+Selenium、SpecFlow 和 NUnit 的多浏览器测试 - Multiple Browsers Tests using Webinator+Selenium, SpecFlow and NUnit 使用 nunit 报告 Specflow 测试的名称、步骤和状态 - Reporting name, steps and status on Specflow tests using nunit 如何在运行时使用Nunit的SpecFlow和C#中忽略验收测试? - How to ignore acceptance tests during runtime SpecFlow and C# using Nunit? 如何并行运行 SpecFlow 测试 - How to run SpecFlow tests in parallel 是否可以通过编程方式运行specflow测试? - Is it possible to run specflow tests programmatically? 使用 Visual Studio 2017 的 specflow + nunit3 中未显示测试 - The tests are not shown in specflow + nunit3 with Visual Studio 2017 如何使用ConsoleRunner运行Nunit测试属于特定的命名空间 - How to run Nunit tests belongs to specific Namespace using ConsoleRunner (NUnit)使用相同的浏览器窗口运行测试(在相同的类中) - (NUnit) Run tests (within same class) using same browser window
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM