Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Testing JSP  RSS feed

s penumudi
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37230
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!