This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I've seen a few similar questions posted but none that quite answered my question directly...
I'm using Selenium Webdriver 2.0 with TestNg and Java and I'm looking for a better way to control the order in which tests are run.
Really all I want is the tests cases to run in the order they're written in the classes.
It's intuitive. Its easy. Its maintainable. And I'm really surprised it's not the default for testNg.
(Why apply some random ordering when it's not explicitly requested by the coder?)
Anyway, I know that I can add a list of methods to my testng xml, but I have 130 tests so far (and several hundred to come!) and such a method list will be far too much for future maintenance.
EG when I add ten test methods I'll have to remember to add all those methods to my xml file. And what happens if I miss adding one? I'll never notice that it was never run...
So this solution would be a maintenance nightmare:
but it's apparently ignored if I don't add a list of methods and the maintenance nightmare of 'include name' lists...
So currently I'm just listing my test classes in the xml file (as above- TestBVT which has 20 methods, etc.), and controlling test run order with 'depends on' annotations on the tests themselves.
However this is not ideal as I am creating dependencies on every method. And I want to remove the dependencies where they are not really necessary.
I only want to use 'depends on' when there is a real dependency.
I've also searched for creating the xml automatically from my @Test annotated methods. But the solutions posted are not clear on how to actually implement.
Any feedback on how to just make testNg run through my test classes from top to bottom, in order written, without any random sorting- or maintenance heavy list generation would be wonderful.
Thanks in advance,