title: TestNG - Two class tests ran in parallel are not prioritized as they should
body: <p>I have the following xml file:</p>
  
  <pre><code>&lt;suite name= "Ecommerce suite" group-by-instances="true" parallel="methods"&gt; 
  &lt;test name = "Sanity tests" verbose = "2" &gt;
      &lt;classes&gt;
          &lt;class name = "tutorialTestNG.Search"&gt;
          &lt;/class&gt;
          &lt;class name = "tutorialTestNG.AccountFunds"&gt;
          &lt;/class&gt;
      &lt;/classes&gt;
  &lt;/test&gt;
  </code></pre>
  
  <p></p>
  
  <p>and these two classes:</p>
  
  <pre><code>    public class Search {
              @BeforeTest
              public void login(){
                  System.out.println("Successfully logged in!");
              }
              @AfterTest
              public void logout(){
                  System.out.println("Successfully logged out!");
              }
              @Test (priority = 1)
              public void search(){
                  System.out.println("Successfully searched!");
              }
              @Test (priority = 2)
              public void advancedSearch(){
                  System.out.println("Successfully advance searched!");
              }
              @Test (priority = 3)
              public void buyProducts(){
                  System.out.println("Successfully bought products!");
              }
  
      }       
  
  
  
       public class AccountFunds {
  
          @Test (priority = 1)
          public void accountSummary(){
              System.out.println("Successfully brought summary of the account!");
          }
          @Test (priority = 2)
          public void fundTransfer(){
              System.out.println("Successfully transferred funds!");
          }
          @Test (priority = 3)
          public void billPayment(){
              System.out.println("Successfully paid bills!");
          }
  }
  </code></pre>
  
  <p>The problem is that when i run the test suite, the methods from both classes with priority = 1 are ran, instead of all methods from one class first and then the other methods from second class. So the output is something like this:</p>
  
  <pre><code>Successfully logged in!
  Successfully searched!
  Successfully brought summary of the account!
  Successfully advance searched!
  Successfully transferred funds!
  Successfully bought products!
  Successfully paid bills!
  Successfully logged out!
  </code></pre>
  
  <p>Any idea why this occurs even though i set group-by-instances variable true?</p>