Hi all,
I'm new to TestNG and I have a question related to the order the test methods are run. I have seen that a similar question was asked
here.
My problem is the following:
I'm testing a webapp and there is a table that shows some items sorted by descending id, so the last one inserted is always on the top. I have no way of filtering the table. I have some tests that work with this, so initially in each test I was inserting a new item. Since inserting the test data is slow and the tests don't always modify the data I thought of moving the data creation to a @SetupClass method.
However the following order can happen, for classes A and B:
1) Setup A
2) Test1 in A
3) Setup B <-- inserts a new row
4) Test 1 in B
5) Test 2 in A <-- fails, because step 3) modified the expected data.
I don't have any dependencies between the tests.
Also, I am running this with a general "All tests" suite from Eclipse. In this suite I'm including all the tests in the package. This is because I don't want to maintain the xml file every time a new test class is added (we have many many tests, and it would be painful to keep track). The
thread I mentioned before suggests using different test elements, but I guess this would mean that I have to manually enter every test class in my xml file, right?
Is there a better way to tell TestNG to run all the tests in a class together if possible? (i.e. not interleaving tests from different classes)
Thanks in advance,
Tomas