I will try and explain my scenario here so that it's clear what I want.
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 DependsOnMethod
in their @Test
annotation. I am also using a DataProvider
which returns 7 values per test (n rows & 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.
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.
When using Factory annotation, it makes my test to not start at all in Eclipse, giving a NullPointerException
. I use an @BeforeClass
annotation which is never run if I use the factory annotation. I am giving this factory annotation on Constructor of the class.
I have tried the group-by-instance
flag in the testng.xml file but that fails too: it runs the tests in the same sequence.
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.
Any help with this is greatly appreciated.
P.S. I am not very good with Java and I been using TestNG for the past 2-3 weeks.
Thanks, John
The easiest way is to invoke these methods manually:
However, grouping by instances should have worked, can you email a small class to the testng-users list so I can reproduce it?
Thanks.