Code coverage can not be a goal for any software development process. It just helps as a tool for developers and management.
While using code coverage by managers it is important to note that more code coverage does not give any guarantee about the correctness of the system. It can not be used as an objective for the team. It may drive the development team towards the wrong direction of getting code coverage. Coverage driven development is very dangerous because it may happen that developers just focused on the silly branching scenarios instead of thinking from the use case and test scenario point of view. Management can use the code coverage information to get a feel of how much more testing required.
Developers also not expected to consider code coverage as a goal. In a test driven development, we need to focus on different scenarios and write the test cases. We can use code coverage information to discover the missing test cases. Some times we expect a particular portion of the code already covered but code coverage shows a gap. This indicates our test is not doing as we expected. Code coverage information helps to find the bugs in test code.
In development process, do the coding and developing cycles until we get satisfied with required functionality. At the end take coverage report and analyze the effectiveness of the tests. We may get some hints about the missing test cases. It is not important to cover every branch of the condition, just for coverage purpose. Add more tests only if it makes sense.
Test Driven Development is driven by tests and tests are driven by use cases and requirements. In this development process code coverage is a tool to get the correct test cases. If we focus on code coverage, development time increases without getting any quality benefit. If we focus on test cases, quality of the software increases and we will get code coverage as by product.
Tuesday, August 14, 2007
Subscribe to:
Post Comments (Atom)
1 comment:
I Agree with you satya.
Post a Comment