This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Testing and the fly likes Ordering of the test cases Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Ordering of the test cases" Watch "Ordering of the test cases" New topic
Author

Ordering of the test cases

Surasak Leenapongpanit
Ranch Hand

Joined: May 10, 2002
Posts: 341
Is there anyway where we can gurantee the ordering of the testCases to
be executed.
I mean to say that test1() executes before test2()?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24168
    
  30

Don't do that.
If you need some setup code to run before a series of tests, you can put it in the setUp() method of a TestSuite object.
But don't write order-dependent tests. It just makes the tests hard to interpret and hard to maintain.


[Jess in Action][AskingGoodQuestions]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Ordering of the test cases
 
Similar Threads
Order of xml elements in the DD
Book
entrySet method... Why Is This The Result?
Adding components dynamically
Classpath Build Order Changes (entries in .classpath file keep becoming reset)