Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 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. And I am unable to run the tests generated by SpecFlow with Nunit 3..

Does any one have an idea if it is possible to use SpecFlow and NUnit version 3 by this moment? Or some other approach, still using NUnit version 2.6.3 and SpecFlow for achieving parallelism?

Thanks!

like image 737
akrsmv Avatar asked Jan 27 '15 07:01

akrsmv


2 Answers

I ran into the same situation. I came up with a solution using Selenium Grid, the task parallel library and the DynamicObject class. I wrote about it here 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.

like image 87
Dave Bush Avatar answered Nov 08 '22 18:11

Dave Bush


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. 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. It also has a nice TeamCity integration. I think its simple enough (3-4 classes in total) and I tried to document all the console options available in the README file

like image 25
akrsmv Avatar answered Nov 08 '22 18:11

akrsmv