wood burning stoves 2.0*
The moose likes Testing and the fly likes How to test a javabean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "How to test a javabean" Watch "How to test a javabean" New topic
Author

How to test a javabean

patt rich
Greenhorn

Joined: Apr 07, 2008
Posts: 21
I have a javabean class. I should add Junit test class for that. I am wondering how to add test cases for getter setter methods. Evenif I add, will that be a proper testing of Java? Or are we just testing the java compiler by doing this?

Thanks
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30080
    
149

Patt,
In general, testing getters and setters directly doesn't add much value. However, a good suite of tests will cover those methods indirectly by testing the classes that call those getters and setters.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to test a javabean
 
Similar Threads
Web application path
Groovy Starting
JavaBean et EJB
convert class java to javabean
New to java testing