You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jens Bartelheimer <je...@gmx.de> on 2006/10/30 11:25:43 UTC

Testing Struts

Hi,

I am looking for best practices and tools in order to test a struts
application, especially unit tests.

In the www i have found tools like HttpUnit, Cactus, StrutsTestCase,
Canoo WebTest,.... But i am not sure which of them is the best way and
if all the projects are maintained nowadays. Can somebody send me some
advice or information how you test your struts application?
StrutsTestCase seems to be a good way to unit test actions, but is this
project still maintained and applicable with the newest struts versions?

Any help is appreciated.

Jens

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Testing Struts

Posted by Ted Husted <hu...@apache.org>.
First, in the scope of Struts 2, something like STC isn't needed,
since Actions can be tested without mocks.

For Struts 1, I used Struts TestCase for some time, and it was quite
good, but it's not a replacement for business logic unit tests or
click-through UI tests. If you are testing the back-end, and the
front-end, testing the Struts middleware can be accepted on faith.

As for testing the backend and the frontend, here's a post from the other day.


On 10/27/06, Ted Husted <hu...@apache.org> wrote:
> First, push as much business and data access logic as possible out of
> the Action class and into a POJO facade that the Action can call. In
> this way, you can test all that outside of the Action. The MailReader
> is a fair example of this, although the data access API is quirky and
> could be streamlined.
>
> After that, what's really left to test is the UI. For UI tests, I used
> WebTest for a long time, but now I strongly recommend Selenium.
>
> * http://www.openqa.org/selenium/
>
> The Selenium IDE (a FireFox plugin) includes a recorder to help jump
> start the tests, and then you can go back and edit the tests, and also
> add test that can't be easily recorded. (Like is a control disabled or
> text not present.)
>
> The best part is that the initial tests can be recorded in HTML and
> the convert to real Java code. The Java code can then be run as part
> of a standard JUnit test (if the Selenium proxy server is running in
> the background).
>
> I actually haven't used the Java tests myself, but I have used the C#
> tests under .NET, and they work great! I'd expect the Java tests to
> work at least as well.

-- HTH, Ted.
* http://www.husted.com/struts/


On 10/30/06, Jens Bartelheimer <je...@gmx.de> wrote:
> Hi,
>
> I am looking for best practices and tools in order to test a struts
> application, especially unit tests.
>
> In the www i have found tools like HttpUnit, Cactus, StrutsTestCase,
> Canoo WebTest,.... But i am not sure which of them is the best way and
> if all the projects are maintained nowadays. Can somebody send me some
> advice or information how you test your struts application?
> StrutsTestCase seems to be a good way to unit test actions, but is this
> project still maintained and applicable with the newest struts versions?
>
> Any help is appreciated.
>
> Jens
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org