• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What is the Completion Criteria of Unit Testing?

 
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When are we done unit testing?
How do we know that we've tested enough during this phase and are to move to next step?
 
Author
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Doug Wang:
When are we done unit testing?
How do we know that we've tested enough during this phase and are to move to next step?


Ah! A trick question
Unit testing isn't a a milestone or phase in the development process. It's a pervasive practice that takes place as your coding. It's just like compiling, or commiting changes to version control, or all those other things that go on. Unit testing is just an aspect of coding.
How do you know you're done? When you've written tests for all the stuff you can think might go wrong with the method you've just written. And how do you know you've thought of everything? Well, in reality you never will know that, but in practice the book is chock full of ideas and acronyms that might help.
The kind of testing that goes at the end of a phase is more likely to be functional testing, and that's a totally separate beast. Unit testing is solely for the benefit of developers, and takes place minute by minute.

Cheers

Dave
 
Doug Wang
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dave Thomas:

Unit testing is just an aspect of coding.


Thanks Dave. You enlighten me a lot!
So the developer codes, does unit testing, codes again, does unit testing again... But when does this developer feel enough confidence to move to code next module?
Should all logic paths of the module be covered by unit tests? Should the module's interface be proved to comply with the specification of module?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Doug,
You move one to the next module when the tests demonstrate that the code does what it is supposed to. In other words, you have test cases for the non-trivial things your class does. (most people don't write tests for getters/setters)
Yes, all logic paths should be covered. Otherwise, you would be leaving out valid cases. It's not neccessary to prove the spec, just to be convincing.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, test driven development helps solve the problem of knowing when to stop. Since the tests are written first, you stop when all the tests pass and tests cover all needed functionality.
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Doug Wang:
When are we done unit testing?
How do we know that we've tested enough during this phase and are to move to next step?


Hi Doug Wang,
I guess the following two threads might be useful for u to think of the role of unit tesing in COding phase... There u will see a lot of info, concerning with the time for unit testing...
https://coderanch.com/t/95030/Testing/why-JUnit
https://coderanch.com/t/95022/Testing/pros-cons-JUnit
 
reply
    Bookmark Topic Watch Topic
  • New Topic