On 10/26/06, Asthana, Rahul <[EMAIL PROTECTED]> wrote:
We are thinking of designing a unit test plan for our struts based application. 
We have found
in past that Junits for struts action are cumbersome to write and difficult to 
maintain.Any
other suggestions? Winrunner?

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.

-Ted.

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

Reply via email to