Reputation: 35
This is my first question here, and I will be very happy to be helped.
I have been using TestNG as a part of my framework for a long time now. And the question I have today is about the testng.xml configuration - to NOT run tests in parallel. And NO, none of my tests are dependent, they are all independent. But, this is for my requirement.
My testng.xml file looks like this:
<suite name="Smoke Test Suite" verbose="3" parallel="tests" thread-count="2">
<test name="Run on Firefox" preserve-order="true">
<parameter name="browser" value="firefox"/>
<classes>
<class name="com.test1"/>
<class name="com.test2"/>
<class name="com.test3"/>
<class name="com.test4"/>
</classes>
</test>
<test name="Run on IE9" preserve-order="true">
<parameter name="browser" value="iexplore"/>
<classes>
<class name="com.test1"/>
<class name="com.test2"/>
<class name="com.test3"/>
<class name="com.test4"/>
</classes>
</test>
<test name="Run on Google Chrome" preserve-order="true">
<parameter name="browser" value="chrome"/>
<classes>
<class name="com.test1"/>
<class name="com.test2"/>
<class name="com.test3"/>
<class name="com.test4"/>
</classes>
</test>
I want the Tests to run in Parallel, but the classes to run one after the other. What I am currently seeing is that when the test is fired off, I have 8 instance of FF, IE9 and Chrome open up. How can I configure it so that "test1" is executed, the browser is closed, new instance opened and then "test2" is run and so forth?
The reason for me having to do this is that, my app has multiple windows opened during each test. And IE9 (being the evil browser it is) does not know how to handle the situation, panics and loses focus on the window midway through the test. It has been suggested, and I have found the same - that it is best to have one instance of IE9 running with nothing else interrupting it.
Suggestions and solutions will be gratefully accepted.
NOTE: All classes are in the same package.
Thanks, -Alister
Upvotes: 2
Views: 1476
Reputation: 1099
You could use three separate suites (xml files) then add them one after the other in the command line. That has the effect of running them in sequence.
Upvotes: 0
Reputation: 4621
You can create Three objects for DefaultSelenium in your @Before method.One for IE, One for FF and One for chrome.
If you are using webdriver you can create 3 separate drivers for the same.
Upvotes: 1