CSC 216 Lecture Notes - Lecture 3: Static Analysis, Cyclomatic Complexity, Findbugs
Document Summary
A test case should be written for each method, if possible. All statements in a method have been covered. In this case, each statement has to be tested. All conditional tests have been evaluated to true and false at least once. All parts of a compound conditional test have been evaluated to true. Benefits of code coverage: a measure of how complete your test cases are. High coverage =/= correctness: can identify paths through the code that you may have missed. Then work from your control flow diagram and basis path testing. Limitation of code coverage: the assumption that you"re done testing if you have high coverage is incorrect. Coverage tools only tell you if you"ve covered what"s there. There may be requirements that you have missed: don"t write test cases only to make your coverage tool happy. Inspect surrounding code for other potential errors, perhaps requirements you"ve missed.