Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Deon Cravalho
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34837
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Deon Cravalho
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic