• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Need a link to Junit testing servlets and EJBs

 
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have searched google but I can not find any good links to papers or tutorials on using Junit to test EJBs and Servlets.

Thanks for any help.

Tony
 
Tony Evans
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have found a good link about cactus that covers this.

http://jakarta.apache.org/cactus/how_it_works.html

Tony
 
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cactus is a little more complex compared to JUnit.

It is sure the testing framework for in-container testing.

If you want simplicity you can continue with Junit + out-of-container testing of your servlets and EJBs.
 
author & internet detective
Posts: 42134
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tony,
First thing is to move as much logic out of the servlets/EJBs as possible. In an EJB, it is often possible to get all the logic out so there is nothing left to test.

For servlets, Mock Objects are useful (easymock, jmock, ...) You can test passing specific parameters in the servlet and check how your application responds.

Once you have done some unit testing, Cactus is good for integration testing.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MockEJB should also be useful for testing your EJB components.
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a list of multiple solutions for mock testing:
mock frameworks.

Hope it helps.

./pope
reply
    Bookmark Topic Watch Topic
  • New Topic