0

Here is my Test Scenario: I have an issue while running parallel test using Selenium Webdriver + Nunit. When I run my script using two browsers (each script with 21 test methods), i.e Chrome and Firefox, at one point my test fails in only one browser. When running the same script again it passes but I get error in some other test method. Sometimes, Chrome works perfectly fine while Firefox fails because of "Element is not visible error" but I can see the element on the screen or vice versa. At one point both the browsers would work fine and my test passes. Moreover, the script runs perfectly fine when I execute it individually. I have no clue why this happens. Am I lacking something in settings or my script?

SurvivalMachine
  • 7,946
  • 15
  • 57
  • 87
Pooja
  • 1

1 Answers1

1

The philosophy behind NUnit's parallel execution feature is that it launches your tests in parallel and reports their success or failure but does nothing special to make it possible for them to run in parallel. That's up to you.

From your description, it seems likely that your failing test is not written in a way that allows two instances to run in parallel. Without seeing some code it's not possible to give specific advice but you should look for fixture members that are using common object state. If you add some sample code, then it might be possible to tell you more.

Charlie
  • 12,928
  • 1
  • 27
  • 31
  • Thank you for the reply. Here is a snippet of my code: [TestFixture] [Parallelizable] public class test{ [Test,Order(1)] public void startup() ..... [Test, Order(21)] public void cleanup() } – Pooja Dec 14 '17 at 05:19
  • Also in every method i am using try{} catch{} to capture a snapshot in case my test method fails. – Pooja Dec 14 '17 at 05:23
  • We would need the actual code to do any more, not just the method headers. If you are able to clean up proprietary info and post it, you should edit your question rather than putting it in a comment because it can be formatted better in that way. Alternatively, link to some code. – Charlie Dec 15 '17 at 13:09
  • If you want to continue on your own, then I suggest removing all tests and gradually adding them back until you find the problem. – Charlie Dec 15 '17 at 13:10