[Mono-list] Question on core test support in Mono

A Rafael D Teixeira rafael.teixeirabr@terra.com.br
Mon, 29 Mar 2004 11:15:48 -0300


Hi David, long time no see,

Have you checked our code coverage tool, Monocov? You simply have to
execute your programs asking mono (the runtime) to use a specific
profiler and then you use monocov to make it into a useful report.

It's in module monocov on the cvs.

Excerpt from the README

<excerpt>
2. USAGE
--------
 
2.1 COVERAGE DATA COLLECTION
----------------------------
 
To produce coverage info for an .NET program, compile it with the -g
switch to generate debug information. After this, run the program as
follows:
 
$ ./mono --profile:monocov prog.exe
 
This will produce a coverage data file called prog.exe.cov. You can run
the
analyser program as follows:
 
$ ./mono monocov.exe prog.exe.cov
 
This will display the class hierarchy of the program with the
corresponding
coverage information.
 
It is also possible to filter the list of classes which need coverage
data
generated. Filters are string which are applied agains the fully
qualified
names of classes, e.g. [assemblyname]classname. You can specify filters
directly on the command line:
 
$ ./mono --profile:monocov:-Security,-[System.Xml] prog.exe
 
There are two types of filters: include filters, whose name begins with
'+',
and exclude filters, whose name begins with '-'. Include filters are
checked
before exclude filters.
 
For example:
 
$ ./mono --profile:monocov:+[corlib],-Hashtable prog.exe
 
This will collect coverage info for all classes in corlib, except the
ones
whose name contains 'Hashtable'.
 
2.2 ANALYSIS
------------
 
  The collected coverage data can be browsed using the monocov.exe
program.
This program will read the data file produced by the profiler module,
and
display its contents in a hierarchical fashion.
  It is also possible to export the contents of a data file into XML,
which
can be viewed in an XSL capable browser like mozilla.
To export the data as XML, run monocov like this:
        monocov.exe --export-xml=<DEST DIR> <DATA FILE NAME>
   
The generated XML files use a default stylesheet which is a bit ugly. It
would
be good if somebody could contribute a better one :)
</excerpt>

Hope it helps,

On Mon, 2004-03-29 at 10:41, David P. Bowler wrote:
> Just thought I'd re-ask and elaborate a bit...
> 
> I am not talking about Nunit type tools, those are great for understanding
> the success/failure of tests... I am talking about innate profiling to
> easily understand that all functions within a project have been covered by a
> test. The term in question is "Code-Coverage" and it is simply a way of
> knowing during the running of a test-suite that all of the code has been
> excercised. It has nothing to do with the success or failure of the tests
> calling the code. 
> 
> In test-driven development, writing test cases is easy. Knowing that you
> have written enough test cases is not. All too often portions of the code
> are missed or some conditions are not met, so entire sub-sections are never
> excercised.
> 
> So, having elaborated what I meant, can anyone tell me if there is any such
> support existing or planned for Mono? 
> 
> -----Original Message-----
> From: mono-list-admin@lists.ximian.com
> [mailto:mono-list-admin@lists.ximian.com] On Behalf Of David P. Bowler
> Sent: Friday, March 26, 2004 10:27 AM
> To: mono-list@lists.ximian.com
> Subject: [Mono-list] Question on core test support in Mono
> 
> 
> 
> Hello...
> 
> I just read an article in MSDN magazine about writing profiler DLLs for
> dotNet that you can tailor to your individual apps to ensure that your test
> programs cover 100% of your code. The profilers simply filter out calls to
> the CLR based upon some criteria built in and they write out listings of all
> functions or even blocks of code that have been hit when running a test
> program.
> 
> Unfortunately for dotNet in this instance, this is something that must be
> written and on a per application basis if you are into hard-core test-driven
> development and want to PROVE that your tests give you 100% code-coverage.
> 
> So, what I am wondering is if Mono currently has this or if there is any
> intent to put supportiong functionality like this in at the CLR level that
> can optionally be turned on to help test-driven code-coverage oriented
> development? 
> 
> Cheers,
> David
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 
> Esta mensagem foi verificada pelo E-mail Protegido Terra.
> Scan engine: VirusScan / Atualizado em 29/03/2004 / Verso: 1.5.2
> Proteja o seu e-mail Terra: http://www.emailprotegido.terra.com.br/
-- 
Rafael "Monoman" Teixeira 
Mono Hacker since 16 Jul 2001 - http://www.go-mono.org/
Mono Brasil Founding Member - http://monobrasil.redesolbrasil.org/
English Blog: http://monoblog.blogspot.com/
Brazilian Portuguese Blog: http://monoblog.weblogger.terra.com.br/