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 "Brehm, Robert P" <ro...@office.xerox.com> on 2004/08/10 18:45:52 UTC

Writing Unit Tests in Cactus

Hello,

I am new to Cactus, and I am therefore on the learning curve.  I am trying to test the following:

1) A JSP page that emits HTML to the user.  The user then submits a form to another JSP page.
2) This JSP page that acts as a front controller.  It process the form and then does queries via a business delegate.
3) If the front controller is successful in (2) then it completes the transaction then forwards to another JSP page.
4) This new JSP page emits HTML to the user who then submits a form to another front controller and so on.

I have the HttpUnit working to get the HTML and submit the form.   I am having great difficulty in trying to determine the steps required to:

1) Intercept parameters that the user submits in a form and,  
2) Call a Cactus test from my client side JUnit program.

Any help would be appreciated.

Regards,

Bob Brehm


RE: Writing Unit Tests in Cactus

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Bob,

Cactus is a unit testing framework which means it will be useful to unit
test your code methods. Cactus will not be good to perform functional
testing. For functional testing, you should use one of the existing
framework (HttpUnit, HtmlUnit, etc). That means that you would write 2 tests
for the following use case: "A JSP page that emits HTML to the user. The
user then submits a form to another JSP page.".

The HttpUnit integration in Cactus is only useful to perform assertions on
the HTML/XML returned in a Servlet response. It cannot be used to send
forms, etc.

Please see http://jakarta.apache.org/cactus/writing/howto_jsp.html to see
how Cactus can help to unit test JSP pages.

For HttpUnit integration, please see
http://jakarta.apache.org/cactus/writing/howto_httpunit.html

Please also check 
http://jakarta.apache.org/cactus/faq.html#faq_chaining_requests

Thanks
-Vincent

> -----Original Message-----
> From: Brehm, Robert P [mailto:robert.p.brehm@office.xerox.com]
> Sent: mardi 10 août 2004 18:46
> To: 'cactus-user@jakarta.apache.org'
> Subject: Writing Unit Tests in Cactus
> 
> 
> Hello,
> 
> I am new to Cactus, and I am therefore on the learning curve.  I am trying
> to test the following:
> 
> 1) A JSP page that emits HTML to the user.  The user then submits a form
> to another JSP page.
> 2) This JSP page that acts as a front controller.  It process the form and
> then does queries via a business delegate.
> 3) If the front controller is successful in (2) then it completes the
> transaction then forwards to another JSP page.
> 4) This new JSP page emits HTML to the user who then submits a form to
> another front controller and so on.
> 
> I have the HttpUnit working to get the HTML and submit the form.   I am
> having great difficulty in trying to determine the steps required to:
> 
> 1) Intercept parameters that the user submits in a form and,
> 2) Call a Cactus test from my client side JUnit program.
> 
> Any help would be appreciated.
> 
> Regards,
> 
> Bob Brehm
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org