I have around 200 test classes for my web application at the moment. I use Selenium2/Webdriver and the tests are written in java, with TestNG used as my framework.
When I run each test by itself, the test will pass 100% of the time.
When I clump any number of tests together into a suite, running the suite will yield random results to my tests. Some will fail one run, pass another, fail another but in a different line of code, and so on.
Is there a known way to ensure the stability of automated tests when run in a TestNG suite?
EDIT: The failures are speed related. Some WebElements will time-out and cannot be found while other times I can see the automation moving more quickly.
Our Setup macro, for example, will fail randomly. It consists of entering a user/pass, clicking a button, selecting a role from a list by clicking on it, and then clicking the continue button. The button becomes enabled once a role is selected. Sometimes the test will try to push the button before it has been enabled. I have not implemented a waitForElement because there are no issues when the test is ran independently. That's just one example.