[Mono-list] newbie looking for testing work and/or clues

Paolo Molaro lupus@ximian.com
Tue, 2 Jul 2002 11:35:33 +0200


On 07/02/02 Nick Drochak wrote:
> | 3) Does there exist any documentation on "how to ensure a class has test
> | coverage"?  By this I mean a checklist or similar document that takes an
> | example class and breaks out all the test cases that should be
> 
> No, there isn't such a system right now.  I'd love a template builder for a
> class that would use Reflection (I suppose) to build a unit test template
> that has TestXXX() for all public members of said class. You would probably
> want to do one or two unit tests by hand first to see what you are getting
> into, and so you can fully appreciate how much the tool helps :)

Actually, it is quite easy to get a coverage report using the profiling
API: you just record all the methods that have been executed and compare
the list with all the methods exported/implemented by an assembly.
It's, like, 50 lines of code. I'll do it once I separate the profile
code in a loadable module. Then, you'll invoke it with something like:

	mono --profile=coverage,corlib corlibtestes.exe ...

You can do it already with simply mono --profile, if you don't mind
doing a bit of munging on the output yourself. A separate coverage
module can create nicer output, though.

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better