The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Code Coverage

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Code Coverage Posted: Mar 13, 2004 11:22 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Code Coverage
Feed Title: Michael Lucas-Smith
Feed URL: http://www.michaellucassmith.com/site.atom
Feed Description: Smalltalk and my misinterpretations of life
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Michael Lucas-Smith

Advertisement

During an update meeting of where WithStyle is at for a potential customer of ours, the CEO of that company threw us a question which we didn't have an answer for. We told him we had 400 passing tests, 4 failing tests and 0 erroring tests. His question, what is the coverage of those tests?

This is a very valid question to ask. You could have 10,000 tests which are completely meaningless to an application - how much application logic do they actually test.

In steps the Zork-Analysis package which can be loaded from Public Store. This package is really neat. It's designed for VW5i which means its browser navigates by namespaces and categories, but that's okay, since categories are not completely defunct yet (they will be in 7.3).

You select your code in the Zork browser and tell it to install method wrappers. Once it has done this, you run your code. It monitors all calls to your code and records the types of the objects being passed in, types of the objects in the instance variables, the type of the object calling it and the type of the object it returns from the method.

Once you've finished, the Zork browser lets you browse all of this informatio in a hypertext kind of fashion. You view the method and click on a variable or selector and it tells you everything it has learnt.

Once you're done, you uninstall the method wrappers and all is back to normal (and back to 100% speed).

But! The zork browser doesn't end there. While you have your information collected, it also tells you coverage statistics. What bits of your code were run and what percentage of that code ran. What is really interesting is when you look at a method and half the method never ran. This is an indication of two things. (a) dead code that will never run, (b) not enough coverage of your code to make that execution path execute.

So lets bring this all together. You wrap up all your code, then run all your tests, and Zork can tell you how much of your code was run - thus, telling you the coverage of your application your tests are giving you. If you wanted to take it further, you could then record all your type information and produce some sort of javadoc type equivalent. We don't do that.

We just record the percentage of code that was executed. Now here's the cincher.. we've added this to our nightly releaser program, which means every night we get an update on how much of our code base we've covered in our tests!

I just sent an email off to the CEO to inform him that our tests cover 71% of our application. That's quite a bit by anyones standards (except Sam of Pollock fame, who probably has 99% coverage :))

Read: Code Coverage

Topic: The absent customer Previous Topic   Next Topic Topic: Compelled to say something stupid

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use