• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

testing the model class

 
Gloria LL
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic