title: How to force TestNG to run all methods in class without switching to another thread in parallel mode
body: <p>I have the following suite XML for running UI tests using Webdriver:</p>
  <pre><code> &lt;suite name=&quot;test suite&quot; verbose=&quot;3&quot; parallel=&quot;classes&quot; thread-count=&quot;2&quot;&gt;
  
  &lt;test name=&quot;extended_smoke_test_suite&quot;&gt;
      &lt;listeners&gt;
          &lt;listener
              ...
          &lt;/listener&gt;
      &lt;/listeners&gt;   
      &lt;groups&gt;
          &lt;run&gt;
              &lt;include name=&quot;somegroup1&quot; /&gt;
              &lt;include name=&quot;somegroup2&quot; /&gt;
          &lt;/run&gt;
      &lt;/groups&gt;
      &lt;packages&gt;
             &lt;package name=&quot;tests.*&quot; &gt;&lt;/package&gt;
      &lt;/packages&gt;
  &lt;/test&gt;
  </code></pre>
  
  <p>When I run this suite, it launches a few browsers(more than 2) and I can observe that it works only in two of them.
  Looks like it starts some test class(TestClass1), executes one of the test methods, and then switches to another class(TestClass2). After completing the test method in TestClass2 it returns back to TestClass1 and continues with it</p>
  <p>As I have lots of test classes this results in multiple open browsers.</p>
  <p>Is there any way to &quot;say&quot; 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 the current moment</p>