Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Providing unit tests

 
Davinder Kohli
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am providing unit tests for all my public APIs in a main method of each class. This I think is the simplest approach, do you think I should go with JUnit?
Thanks.
 
peter wooster
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Davinder Kohli:
I am providing unit tests for all my public APIs in a main method of each class. This I think is the simplest approach, do you think I should go with JUnit?
Thanks.


Whatever you do, don't include your test code in what you submit. It just provides more ways to be wrong. I built my test code as a seperate package that used the classes in suncertify. This code did unit testing of the locking and database code and provided a very general client that let me do things like lock records and forget about them.

I'm not all that convinced that unit testing by itself is really sufficient. I like to combine that with coverage testing that confirms that all parts of the program have actually been executed. This is one of the best ways to ensure that your test plan is sufficient. I used Emma to do the coverage monitoring.
 
Eric Chang
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also curious on why you would want to include your unit tests in what you submit. You will gain absolutely nothing from it, and it may even cause confusion for whoever assesses your project.
 
Frans Janssen
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by peter wooster:


Whatever you do, don't include your test code in what you submit. It just provides more ways to be wrong. I built my test code as a seperate package that used the classes in suncertify.


Hmm, I also used a separate package for testing, but I did send it with my assignment. AFAIK I did not get any deduction for it (but that can be of course because my test code was excellent ).

I agree there is a risk in submitting your test code, but in a real project, I mostly do that too. It's good to have test functionality available when customers report problems, it gives you an opportunity for remote analysis without the need of directly having to go there.

Frans.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic