Join Simon Allardice for an in-depth discussion in this video Measuring code coverage, part of Foundations of Programming: Test-Driven Development.
- [Voiceover] One number that's often measured when…using automated unit test is Code Coverage.…Simply put, this is a percentage measurement of exactly…how much of your application code is being successfully hit…by your unit tests.…It's certainly not a guarantee of perfection.…Just because you've executed a line doesn't mean you've…tested every possible combination of data and of options…that could have gone into that line.…But code coverage will certainly let you know what…you're missing.…Even the most basic code coverage reports will typically…tell you different numbers for how many of your classes…are being tested and within those how much of your methods…are being tested, and the blocks and even individual lines…of code inside those methods.…
Now, as you might expect, this is something that is done…with a tool that can perform this analysis.…And there are a lot of code coverage tools.…Some that are free quite a lot are commercial.…And the options are much better in enterprise heavy…environments, say Java and .NET than they are in languages…
The course explores the jargon of TDD—test suites, test harness, mock and stub objects, and more—and covers how TDD is used in the most common programming languages and environments. Plus learn to create, run, and manage the tests and move to a test-first mindset.
- What is test-driven development?
- Using unit testing frameworks
- Creating tests
- Using assertions
- Creating multiple test methods
- Naming unit tests and test methods
- Testing return values
- Setting up and tearing down
- Introducing mock objects
- Measuring code coverage