wood burning stoves 2.0*
The moose likes Servlets and the fly likes testing the model class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "testing the model class" Watch "testing the model class" New topic
Author

testing the model class

Gloria LL
Greenhorn

Joined: Nov 01, 2005
Posts: 1
Hello one and all.

I am reading the head first servlets & jsp book and was wondering if anyone had the code for writing the test file for testing the model class. I have never written one so I have no clue. Thanks in advance for any help.


glarsen
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

"Gloria LL",

Welcome to the Ranch. There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Originally posted by Gloria LL:
Hello one and all.

I am reading the head first servlets & jsp book and was wondering if anyone had the code for writing the test file for testing the model class. I have never written one so I have no clue. Thanks in advance for any help.


The reason to seperate the model from the controller...or in words keeping the business login at some other layer not in the servlet is testing.so that for testing the business logic we should not be needing the servlet container..
for testing of the business logic you can use JUnit testing.

http://www.junit.org

cheers!


Rahul Bhattacharjee
LinkedIn - Blog
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Rahul Bhattacharjee:
you can use JUnit testing.


JUnit might overkill here. You just need to add a main method to your business classes/class in order to test. Then you just need to execute that like normal java application.

Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: testing the model class
 
Similar Threads
doubt in model design
Junit testing for model classes
Part II - Dreamcar questions
Issues with JTextArea as cellEditor of JTable Column.
Where To Package Enums