1

I am working on BDD (written in selenium webdriver with c#). For sequential execution we were using nunit but now the client requirement is parallel execution. Gone through so many documentation but only found Pnunit. Steps executed till now

  1. downloaded pnunit
  2. changes the setup method the use pnunit
  3. created agent.conf file
  4. run "agent agent.conf" to start agent
  5. created app.conf file for parallel execution
  6. run "launcher app.conf" for execution

but its also not working. It says that class is not found under dll. Please provide any suggestions.

-Neeraj

Neeraj Hatwal
  • 49
  • 1
  • 1
  • 8

3 Answers3

1

Concurrent execution is not supported by Specflow using the standard test runners as the Specflow engine itself is not thread safe. This issue has been addressed and is currently being tested, and the fixed code should be merged in the next few weeks. Please see the discussion here and here

It is possible to use app domain isolation to run tests in parallel, Specflow+ and NCrunch use this technique.

Sam Holder
  • 32,535
  • 13
  • 101
  • 181
  • Hi sam parallel execution is possible using specrun but its paid version of specrun thats why i switch to specflow+pnunit. Do you know how to execute tests using specflow+pnunit otherwise i have to switch to othe test framework like ncrunch or MStest. – Neeraj Hatwal Jun 25 '15 at 08:49
  • As I said parallel execution should be possible with any test runner which uses app domain isolation. NCrunch does this, but is a paid tool as well. I'm not aware of any free test runners which use app domain isolation. MSTest won't help you here I don't think. As I indicated this is close to being supported in standard specflow with NUnit 3.0 and XUnit 2.0, but this is not available at this moment. One alternative is to split your tests into categories and have multiple NUnit instances run separate categories at the same time. – Sam Holder Jun 25 '15 at 08:55
1

I've developed a method of running selenium tests in parallel that I've written about here http://blog.dmbcllc.com/running-selenium-in-parallel-with-any-net-unit-testing-tool/

Dave Bush
  • 2,382
  • 15
  • 12
  • Hi Dave i gone through your documents and the video tutorial it was great but i never worked on page object modelling and i have limited time frame so i was looking for some pre designed framework thats why i choose pnunit for parallel execution. – Neeraj Hatwal Jun 25 '15 at 08:46
  • I'm so sorry to hear that you are not using Page Models. They ultimately make life so much easier. You should refactor your code as soon as possible to use them. – Dave Bush Jun 25 '15 at 22:33
  • I have consolidated all possible scenarios and found that either I have to switch to page object model framework or buy the licence for any paid test framework. – Neeraj Hatwal Jun 26 '15 at 08:42
  • If you have any other suggestion do let me know. – Neeraj Hatwal Jun 26 '15 at 08:43
1

YOu can try this tool https://github.com/qakit/ParallelTestRunner. I developed it for running NUnit tests in parallel (actually it will run in parallel not tests but testfixtures in your tests lib). Works fine for me =). If you will face any problems report me, will try to solve.

Andrey Egorov
  • 1,249
  • 1
  • 12
  • 9
  • Hi Andrey this looks like a source code for the tool. please let me know how to use it for my framework. I am using remote webdriver and nunit as a runner for specflow scenarios. – Neeraj Hatwal Jun 25 '15 at 08:36
  • This tool allow run NUnit tests in specified dll in parallel. It's almost same as NUnit runner (console). You just need to compile your tets in dll and pass it as argument to the tool (smgh like: run yourtest.dll --localrun=2). If you have more specific questions please open new case in github with sample of source code. – Andrey Egorov Jun 25 '15 at 08:55
  • Hi Andrey i have a quick question for you, can we run bdd scenarios using this tool or is it specific to nunit test cases. Because i am able to run nunit test cases in parallel but not bdd test cases because pnunit looks for [Test Method] annotation in class not [Given] [When] [Then] annotaions. – Neeraj Hatwal Jun 26 '15 at 08:46
  • I understand now... yes, actually this tool only supports for now tests developed using NUnit.Framework with [Test]/[TestCase] etc attributes, if you provide me a sample of dll with tests (or simple project) i'll try to add this abililty to this tool. Thanks. – Andrey Egorov Jun 26 '15 at 09:21
  • Ok i will provide a sample feature file written in specflow and the definition file written in selenium. – Neeraj Hatwal Jun 26 '15 at 10:53
  • Could you please add it as an issue to tool report on github. Thanks. – Andrey Egorov Jun 26 '15 at 13:17
  • This should not be a problem as Specflow generates tests with the correct attributes, so actually no test frameworks run the [Given] [When] [Then] from the steps, they all run the tests generated by specflow in the feature.cs class, which will have the [Test] attributes (if your specflow language is NUnit. – Sam Holder Jun 29 '15 at 16:12
  • Hi Sam, Thanks for the clearification. I gone through the feature.cs file and you were right it generate a test case according to scenario defined in feature file.So I think i have to provide the test name in config file from the feature.cs file instead of step definition file. Will update you soon if I get any issue. – Neeraj Hatwal Jun 30 '15 at 09:15