• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Testing Web Applications,Servlets using JUnit

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am using Forte and Junit Module in it.
How can i test the servlets using JUnit module in Forte
Thanx in advance
Ajit
 
Aji Ozkan
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I got some solution
We have HttpUnit for this
http://www.httpunit.org
but still unable to get it working..
Ajit
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HTTPUnit is the right path.... what's the problem you're having?
 
Aji Ozkan
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I downloadede HttpUnit JAR files.
I wrote the simple code likt this

This compiles correctly but at runtime gives error like this

Do you know what can be the problem?
Ajit
(Marilyn reformatted to shorten lines)
[ February 13, 2003: Message edited by: Marilyn de Queiroz ]
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like you are running against an incorrect version of Xerces. Do you know which version you are using, or where you got it from?
Simon
[ February 07, 2003: Message edited by: Simon Brown ]
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Notice that the tests you write using httpUnit are more like system tests - you need to deploy the servlets to the servlet container before running the tests etc.
You can also test servlets by calling the doXxx method(s) directly and providing a dummy/mock-implementation for the response, request and accompanied objects. You can download a simple implementation from
http://www.dpunkt.de/utmj/utmj-servlet.zip
Another one can be found at http://www.mockobjects.com/
 
Aji Ozkan
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx guys for replying..
Ajit
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Checkout this article on using mock objects (or Imposters) to unit test servlets.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
looks like you're using the nekohtml.jar that is distributed with httpunit. the full distribution of nekohtml includes nekohtmlXni.jar which includes the required class.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just to confirm - that was it. get it at http://people.apache.org/~andyc/neko/doc/html/
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic