Not able to close browser when parallel test runs. So test fails

143 views
Skip to first unread message

Vishal Pachpute

unread,
Jul 9, 2017, 1:10:56 AM7/9/17
to seleniu...@googlegroups.com
Hi

I want to run my tests in parallel. 

I am able to launch multiple browsers. But at the end, these browsers are not closed.

So some tests fails. (When I runs in sequential manner, all test passes) 

Can anyone please help me in this. 

Note:
1. In LaunchApplication.java, I am launching my webdriver
2. In Demo.xml, currently I took only 2 tests
3. In ERCC_Login.java, I have test methods

Regards
Vishal

Demo.xml
ERCC_Login.java
LaunchApplication.java

Krishnan Mahadevan

unread,
Jul 9, 2017, 1:37:57 AM7/9/17
to seleniu...@googlegroups.com

You have the following problems in your code:

 

  • Your webdriver instance is static. When it comes to supporting parallel execution, static variables are a big hurdle and cause a lot of confusions. You are experiencing that.
  • Your webdriver instantiation is being done in a @BeforeTest annotation. This again is a big put off in TestNG because a @BeforeTest gets invoked only once per <test> tag. So if you have two or more test classes which try to work with data initialized via the @BeforeTest, the second test class starts experiencing NullPointerExceptions.

 

If you are interested in doing parallel execution, you might want to take a look at this blog of mine: https://rationaleemotions.wordpress.com/2013/07/31/parallel-webdriver-executions-using-testng/

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CALKd3R5jnfsJKLYmAb44W0D37zqQ7NttSon5aaptStuyw9-rvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages