TestNG segregates test methods into two batches: Tests that depend on other tests, and tests that do not depend on other tests. And it seems to run /all/ of the tests in the second batch before it runs any tests in the first batch. This creates a problem for one of my clients that I can't figure out how to solve.
Here is our scenario:
- We are testing a web app using Selenium RC.
- The Selenium server is on Sauce Labs.
- Because launching a browser session can take 20 seconds, we launch one session per test class, in a @BeforeClass. All test methods in the class use the same browser session.
- We instruct TestNG to use six threads, one test class per thread.
- Many test classes have chains of dependent test methods. Each dependency is on another test method in the same class; there are no dependencies from one class to another.
Here is the problem:
- TestNG runs the @BeforeClass methods for some of the classes (six of them, I think, one per thread), which launches the browser sessions on Sauce Labs.
- TestNG runs the non-dependent test methods for those classes.
- The shortest-running test methods finish long before the longest-running non-dependent test methods.
- The threads for the short-running non-dependent test methods remain idle while TestNG finishes the longer-running non-dependent test methods on the other threads.
- The threads remain idle even though no thread has any dependency on other classes or threads.
- While these threads are idle, the Sauce Labs Selenium sessions are also idle.
- We pay Sauce Labs while the sessions are idle.
- After several minutes without receiving a Selenium command, Sauce Labs assumes the test has gone awry, and aborts the session.
Because of this, we have had to abandon TestNG's built-in dependency mechanism use our own. We would prefer to use dependsOnMethods if we could solve the problems I described above.
Is there a way to convince TestNG to run begin running dependent test methods immediately, even though other classes are still running their non-dependent test methods?
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.