title: TestNG - Dataprovider at Class level test annocation
body: <p>I will try and explain my scenario here so that it's clear what I want.</p>
  
  <p>I have a set of methods within a Class which performs a few tests, they are all related to each other and have to be run in a sequence, so they have <code>DependsOnMethod</code> in their <code>@Test</code> annotation. I am also using a <code>DataProvider</code> which returns 7 values per test (n rows &amp; 7 columns). Now when I put this data provider at the method level, it reads all the rows and executes Method 1 with every set of data available, then moves onto next method.</p>
  
  <p>I want this sequence changed, I want it to run Method 1 (data set 1), Method 2 (Data set 1), Method 1 (Data set 2), ... I know this a question many people have. The reason I am posting this question again is because I have tried all the suggested ideas.</p>
  
  <p>When using Factory annotation, it makes my test to not start at all in Eclipse, giving a <code>NullPointerException</code>. I use an <code>@BeforeClass</code> annotation which is never run if I use the factory annotation. I am giving this factory annotation on Constructor of the class. </p>
  
  <p>I have tried the <code>group-by-instance</code> flag in the testng.xml file but that fails too: it runs the tests in the same sequence.</p>
  
  <p>Please can someone explain this whole thing in the correct order for me? If possible with an example, as I'm sure this can be achieved but I guess I am missing something somewhere.</p>
  
  <p>Any help with this is greatly appreciated.</p>
  
  <p>P.S. I am not very good with Java and I been using TestNG for the past 2-3 weeks.</p>
  
  <p>Thanks,
  John</p>