File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Testing and the fly likes JUnit 3.8: trying to accomplish something like Parameterized J-Unit 4.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "JUnit 3.8: trying to accomplish something like Parameterized J-Unit 4.0 " Watch "JUnit 3.8: trying to accomplish something like Parameterized J-Unit 4.0 " New topic
Author

JUnit 3.8: trying to accomplish something like Parameterized J-Unit 4.0

Deon Cravalho
Greenhorn

Joined: Oct 22, 2009
Posts: 6
Greetings,

I am forced, at the present time, to use Ant 1.6.5 (within WebLogic). Ant 1.6.5 is not compatible with JUnit 4, from my readings.

I have quite a few methods that need to be tested, but with varying combinations of arguments. Now JUnit 4 has parameterized JUnit tests you can build, which is what I want. However I am forced to use JUnit 3.8. Thus, my only initial idea is to pass my varying list of arguments into my method within a loop and then run the method. Is there a better way to handle this, until I can upgrade to use JUnit 4 parameterized JUnit tests?

Thoughts/ideas on what to do to make my tests "cleanest" would be great! Maybe I'm stuck with sending in array of various arguments, or doing a loop of some sort on the method to send in the different sets of arguments.

Other info: using Java 1.5 and Spring 2.0. Just in case this info is needed for someone supplying me with help. Thank you.

Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

Deon,
In JUnit 3.8, the pattern still exists, but it's not a built in construct. What you do is implement a suite() method. In that method you build a suite containing the parameterized tests you want to run. I use a loop where I go through the list of things I want to test.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Deon Cravalho
Greenhorn

Joined: Oct 22, 2009
Posts: 6
Thank you for the quick reply. I will go forth with the idea you mentioned. And, hopefully soon upgrade to JUnit 4 once my Ant (within WebLogic) gets upgraded!

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JUnit 3.8: trying to accomplish something like Parameterized J-Unit 4.0