rpbrehm (1) [Avatar] Offline
#1
Hello,
I really enjoy your book - I have been using it daily.
I do have some confusion however regarding in container testing using Cactus. I am writing JUnit tests using a variety of extensions - HttpUnit, Cactus, and others.

I am stumped when it comes to running Cactus from JUnit. Pages 179 - 182 describe the process. However there are no examples of how to do this (am using Eclipse 3.0 BTW). I have the following questions:

1) How does the client side Unit tester invoke the redirector?
2) What configuration is required to invoke the redirector?
3) How does the server side cactus test programs return parameters to the client side?

Any examples or help would be appreciated.

Regards,

Bob Brehm
vmassol (51) [Avatar] Offline
#2
Re: Chapter 8 - In Container testing with Cactus
Hi Bob,

> Hello,
> I really enjoy your book - I have been using it
> daily.

I'm really glad you like it! smilie

> I am stumped when it comes to running Cactus from
> JUnit. Pages 179 - 182 describe the process.
> However there are no examples of how to do this (am
> m using Eclipse 3.0 BTW). I have the following
> questions:
>
> 1) How does the client side Unit tester invoke the
> redirector?

The Cactus client side code (the XXXTestCase) open an HTTP connection to the Cactus redirector installed in the webapp.

> 2) What configuration is required to invoke the
> redirector?

It depends how you are invoking your Cactus tests. There are several ways to run your Cactus tests: command line, using Ant, Maven, from IDE, using the Servlet Test Runner, etc.

The way to configure each way to run Cactus is documented here: http://jakarta.apache.org/cactus/integration/index.html

> 3) How does the server side cactus test programs
> return parameters to the client side?

It doesn't return any parameter. It only returns a result of the test (with the exception if there was any).

>
> Any examples or help would be appreciated.

Cactus examples can be found both in the book source code (http://sourceforge.net/projects/junitbook) or in the Cactus distribution (http://jakarta.apache.org/cactus/downloads.html).

Hope it helps,
-Vincent