Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Unit Testing Filter, Servlet, JSP

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

In general, how would you unit-test Filter, Servlet and JSP?

- Use a mock library? (I searched for MockHttpServletRequest/Response and it seems each framework out there have their own version, is there any stand-alone HttpServlet mock lib?)
- How would you mock the HttpSession for authentication purposes? what is the usual workflow? would you need the web-container/server to be up and running?
- Is it usual that the unit-tests are run against a running DB? or the DB is also mocked? would the running DB be a bottle-neck on setup/teardown?

In the ideal world, I would love that the unit-tests run pretty fast without having to boot up the web server or database, but if that is something impossible, so be it.

Can anyone share their best practices and some of the issues stumbled upon unit-testing?

PS: If anyone has done TDD for a pure Java web-app (base library without the use of Spring/Struts etc), please share your experience as well.

Thank you,
Ed
 
I think I'll just lie down here for a second. And ponder this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic