aspose file tools*
The moose likes Testing and the fly likes How to implement unit testing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "How to implement unit testing" Watch "How to implement unit testing" New topic
Author

How to implement unit testing

Anthony Karta
Ranch Hand

Joined: Aug 09, 2004
Posts: 342
Hi all,

I'm not sure if someone already asked this question.

I'm new with Java and I have never implement unit testing.

I have read about JUnit or Cactus in general but how to apply them - are there online resources available with sample codes??

I'm working on Servlet, JSP, XML/XSL, JDBC.

many thanks
anthony


SCJP 5
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I would start by reading the official documentation and some articles from JUnit.org. Reading a good book on the subject wouldn't be a bad idea either.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Anthony Karta
Ranch Hand

Joined: Aug 09, 2004
Posts: 342
thanks lassle!

actually, I am reading some articles in Junit.org now.

which book do you suggest? I'd like more to coding/practical approach than just talking.

thanks
tony
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Tony Karta:
which book do you suggest? I'd like more to coding/practical approach than just talking.

Probably Unit Testing in Java by Johannes Link or Junit in Action by Vincent Massol. J.B. Rainsberger's JUnit Recipes should also be a terrific cookbook after you've mastered the basics.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Lasse Koskela:

Probably Unit Testing in Java by Johannes Link or Junit in Action by Vincent Massol.


Seconded. "JUnit in Action" mostly concentrates on web applications in the later chapters, whereas "Unit Testing in Java" also contains a chapter on GUI testing and puts more weight on test driven development in general.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Adel Aneiba
Greenhorn

Joined: Sep 01, 2004
Posts: 8
Hi,

There are two nice books explain how to use Junit and other realted topics. The books are:

Junit in action: ISBN:1-930110-99-5
Junit Recipes: ISBN:1932394230

Good Luck

Adel
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
I just assembled http://faq.javaranch.com/view?GoodBooksOnTesting - add anything you find missing!
Anthony Karta
Ranch Hand

Joined: Aug 09, 2004
Posts: 342
thanks lassle!

actually, I am reading some articles in Junit.org now.

which book do you suggest? I'd like more to coding/practical approach than just talking.

thanks
tony
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
See my previous reply...
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Tony Karta:
thanks lassle!

actually, I am reading some articles in Junit.org now.

which book do you suggest? I'd like more to coding/practical approach than just talking.

thanks
tony


I'm having a d�j� vu...
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
See my previous reply...
 
Don't get me started about those stupid light bulbs.
 
subject: How to implement unit testing