![]() ![]() It’s just a measure of whether or not the tests execute the code.) (Don’t confuse code coverage with an assessment of the quality of your tests, though. In just about any language and tech stack imaginable, you have ways to detect how thoroughly the unit test suite covers your codebase. They’ve automated code coverage detection. So developers have done what developers do. Well, as you can imagine, computing code coverage the way I just did would get pretty labor intensive. For instance, code coverage analysis would tell us here, “Hey, you need to test the case where you pass a 0 to the method for y.” What Are Code Coverage Tools? So in the grossest of terms, that’s the “what.” As for the “why,” developers can use code coverage analysis to see holes in their testing efforts. Absent any other tests, no automated test ever executes that last line. Well, this test would cause the runtime to test the conditional and then to execute the return x/y statement, thus executing two-thirds of the method. Let’s also say that we wrote a single unit test, from which we invoked Divide(2, 1) and asserted that we should get back 2. Let’s say this was the only method in our codebase.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |