This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
So what do you folks use to unit test your struts app?
StrutsTestCase? (Mock object approach or Cactus approach?) HttpUnit? plain Cactus?
I've got a typical Struts app with a DB backend, so can I really test it with Mock objects if I need to be able to ping the DB for data? BTW, I never insert data in the DB with my app, its all just viewing data that already exists in the DB.
ahhh good point -- all my business logic is in my "helper" methods -- so I guess I can just do straight JUnit tests on those to test. Although I guess I'll need to use some mock objects to handle request / session scopes and stuff, right?
Jess, In the past I've used a BusinessDelegate(s) which gets called from my Action class(s). The business delegate does not know anything about servlet classes or struts classes. So, I can write my junit tests without having to create Mock objects, just test the business functionality that is exposed by the methods on the business delegate(s). The business delegate, then uses whatever other classes you have designed (Session Facade, BOs, etc.). This way there is little testing of the Action class that is needed, because you would essentially be testing the Struts Framework. Hope this helps. [ May 14, 2004: Message edited by: Tim Brizard ]
I agree with what other people have had to say regarding testing Struts app. The reason is the same: All the business logic gets tested in their respective JUnit methods. The only tests that I do for my Struts classes is actually launch the browser to do a manual end-to-end testing - that too only when I write/modify that code.
However the reason for this is that the company I work for has QA team that records the regression test scripts using commercially available tools.
In the absence of such regression scripts, I think Struts Test case or equivalent might be needed.
On another note, does anybody know of a open source/free regression test recorders that has the capability of parameterization and assertion (like the commercial tools)?