Code coverage has been explained well in the previous answers. So this is more of an answer to the second part of the question.
We've used three tools to determine code coverage.
- JTest - a proprietary tool built over JUnit. (It generates unit tests as well.)
- Cobertura - an open source code coverage tool that can easily be coupled with JUnit tests to generate reports.
- Emma - another - this one we've used for a slightly different purpose than unit testing. It has been used to generate coverage reports when the web application is accessed by end-users. This coupled with web testing tools (example: Canoo) can give you very useful coverage reports which tell you how much code is covered during typical end user usage.
We use these tools to
- Review that developers have written good unit tests
- Ensure that all code is traversed during black-box testing