You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Brian Ivey <cb...@comcast.net> on 2004/03/24 15:29:41 UTC

Cactus or JUnit

I am new to Cactus, JUnit, and StrutsTestCase.  In fact, this is the first
time I've attempted to perform any structured testing.  I've successfully
written some Struts test cases.

My question is basically one of design.  I am trying to test a server side
object that is neither a Servlet, JSP, or EJB.    It contains no Struts
code.  It just contains an algorithm for building an HTML menu.  My first
guess is that JUnit should be used.  Would anyone agree with this?

Also, in the application I am testing Session IDs need to be passed between
pages.  Is there a best practice for storing this in my testing package for
reuse among the different test cases?

Thanks,
Brian Ivey


Re: Cactus or JUnit

Posted by "J. B. Rainsberger" <jb...@rogers.com>.
Brian Ivey wrote:

> My question is basically one of design.  I am trying to test a server side
> object that is neither a Servlet, JSP, or EJB.    It contains no Struts
> code.  It just contains an algorithm for building an HTML menu.  My first
> guess is that JUnit should be used.  Would anyone agree with this?

It's not server-side code (= code that needs a server to run). It's code 
that happens to run within an app server. If it's plain Java, then test 
it as plain Java, using plain JUnit, exactly as you say.

Remember this, though: Cactus /is/ JUnit; Cactus merely runs it 
transparently in an app server for you.

> Also, in the application I am testing Session IDs need to be passed between
> pages.  Is there a best practice for storing this in my testing package for
> reuse among the different test cases?

I don't understand this. I hope someone else did. If not, then please 
explain it differently.
-- 
J. B. Rainsberger,
Diaspar Software Services
http://www.diasparsoftware.com :: +1 416 791-8603
Let's write software that people understand