I agree.

I tend to use businsess facades that the actions get from an
AbstractFactory.

For testing, it instantiate a test Factory that delivers fake (mock)
business facades.

In the container, it instantiates a real Factory that delivers up business
facades that talks to Stateless session beans.



-----Original Message-----
From: Bryce Fischer [mailto:[EMAIL PROTECTED]
Sent: Sunday, January 18, 2004 6:01 AM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: Cactus vs StrutsTestCase


I agree.

There are two frameworks I've seen to test struts based web stuff. The
easiest to use is StrutsTestCase (the other is mockrunner). It can use
both a Mock container as well as Cactus. I haven't gotten around to
using the CactusTestCase, as I do most of my unit testing without the
overhead of the container (to me, that's for integration testing). The
Mock container does a good job I feel.

I do have an EJB layer, but I use an interface for my Struts delegate
methods. This allows me to send a Mock'ed object of my interface to my
Struts Action class to test, without having to go through the EJB stuff
(For EJB stuff, I'm using MockEJB, but that's a different email).

Nice thing about using Mocks for my delegate classes, is that I can
simulate lots of different things. I can tell it to pass anything back
to the Action servlet, including throwing exceptions. This allows me to
make sure my Action Servlets are handling all kinds of situations.

HTH

> Hi, Ashikuzzaman£¡
>
>       I use StrutsTestCase to test my struts-based web tier action. Because
StrutsTestCase
> use mock object to mock the container. So you needn't start your
container(tomcat or jboss)
> to test your action class. It's a very fast way to test.
>       However, StrutsTestCase can not mock EJB call. So if your web application
contains EJB
> you should use cactus, which can start jboss automatically to test your
code, or you use the MockEJB to mock your ejb call.

--
Bryce Fischer <[EMAIL PROTECTED]>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to