I have following suite xml for running UI test using Webdriver:
<suite name="test suite" verbose="3" parallel="classes" thread-count="2">
<test name="extended_smoke_test_suite">
<listeners>
<listener
...
</listener>
</listeners>
<groups>
<run>
<include name="somegroup1" />
<include name="somegroup2" />
</run>
</groups>
<packages>
<package name="tests.*" ></package>
</packages>
</test>
When I run this suite, it launches few browsers(more then 2) and I can observe that it works only in two of them. Looks like it starts some test class(TestClass1), execute one of test methods and then switches to another class(TestClass2). After completing test method in TestClass2 it returns back to TestClass1 and continue with it As I have lots of test classes this results in multiple opened browser.
Is there any way to "say" TestNG to execute all tests from TestClass1 and only after that switch to next, so we will have only two opened and active browsers at current moment