File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Testing the code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Testing the code" Watch "Testing the code" New topic

Testing the code

madhav changala
Ranch Hand

Joined: Dec 20, 2005
Posts: 57
Hi all

i would like to know is there any enviornment or site.. for testing our servlet code and jdbc coding without installing any servers and databases..

If you know please send me the URL and instructions how to test the code.

thanks and regards


SCWCD (preparing)

Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Testing a database without a database, or testing a Servlet without a server seems like it would be impossible....or would it?

I think what you want is JMock at

jMock is a library for testing Java code using mock objects1.

Mock objects help you design and test the interactions between the objects in your programs.

The jMock package:

* makes it quick and easy to define mock objects, so you don't break the rhythm of programming.
* lets you define flexible constraints over object interactions, reducing the brittleness of your tests.
* is easy to extend.

You can create mock objects that behave like a database connection, and test against them. As a result, you can test your code, but not really have a database connection. JMock is great.

I'm not sure how you mock out a Servlet though.

Give it a try!

-Cameron McKenzie
madhav changala
Ranch Hand

Joined: Dec 20, 2005
Posts: 57
Thansk Cameron W. McKenzie

What i mean testing the code .. is not the junit or someotherthing else ...

Actually what i need is i want to run my servlet code and jdbc code with out installing server amd databases in my local machine ...

Any webiste which will run our code display result...

thanks and regards
I agree. Here's the link:
subject: Testing the code
It's not a secret anymore!