wood burning stoves
The moose likes Testing and the fly likes Testing JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Testing JSP" Watch "Testing JSP" New topic

Testing JSP

s penumudi
Ranch Hand

Joined: Nov 17, 2004
Posts: 113
Hello Experts there,

I need some and help and kind of direction to go about writing my test cases to test JSP.

This is my application Architecture:

JSP<->Struts<->SL is my web component and currently I am least or not at all concerned about Business and DB Classes. Currently I am coding my web component and wanted to write test cases for the same.
SL above are just POJO's where I have lookup for my business classes. As of now I have some dummy data hardcoded which I use to test my JSP manually through browser.

What approach you all would suggest me to go with.
I have looked at Cactus, It provides testcases for Servlets, Jsp Tag libraries and Filters.

How can I write test cases for my Jsp pages using Cactus.
There is one more point here. As I am using Struts, Can I test my JSP's without using StrutsTestCase framework?

I see so many frameworks for testing. But I don't see any procedure or help to go about writing testcases for project like mine. If I have to combine these test frameworks what would be the best process. And I guess most of the project have very similar architecture as mine.

Your help and direction would be greatly appreciated.

Thank you very much inadvance.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

First thing to note is that all of these frameworks build on top of junit.

I would recommend starting by testing the Struts actions themselves. You can use mock objects (easyMock and jMock are good frameworks) to get mock request/response objects. Through these pure junit tests, you can test the logic without a server running.

Once the action is tested, Cactus can test the JSPs themselves.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link: http://aspose.com/file-tools
subject: Testing JSP
It's not a secret anymore!