# Code coverage of ironruby code

**URL:** <https://www.ruby-forum.com/t/code-coverage-of-ironruby-code/175985>\
**Category:** IronRuby\
**Created:** [September 23, 2009, 11:25am UTC](https://www.ruby-forum.com/t/code-coverage-of-ironruby-code/175985 "2009-09-23T11:25:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [September 23, 2009, 11:25am UTC](https://www.ruby-forum.com/t/code-coverage-of-ironruby-code/175985/1 "2009-09-23T11:25:47Z")

</div>

Hi  
Is there a way to get the code coverage when running RSpec or Test::Unit  
stuff with ironruby? It would help me a lot to set build tresholds etc.

Because I guess the C# tools won’t be able to do it and the ruby tools  
neither.

Is it in the cards? What would it take to implement something like that  
for  
IronRuby?

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))

---

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [September 23, 2009, 6:10pm UTC](https://www.ruby-forum.com/t/code-coverage-of-ironruby-code/175985/2 "2009-09-23T18:10:56Z")

</div>

If you want to get coverage numbers for C# code you should be able to  
do:

set PERF\_TOOLS=%VSINSTALLDIR%\Team Tools\Performance Tools  
set DSTDIR=an empty directory to store dlls you want to instrument to  
(the tests must load them from here)

# instrument each dll for which you want to get the coverage numbers

“%PERF\_TOOLS%\vsinstr.exe” /coverage /outputpath:%DSTDIR% your.dll

# start code coverage service:

“%PERF\_TOOLS%\vsperfcmd.exe” /start:coverage /OUTPUT:report\_file

# run your unit tests here

# stop code coverage service

“%PERF\_TOOLS%\vsperfcmd.exe” /shutdown

Open report\_file.coverage in VS.

Tomas

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Ivan Porto  
Carrero  
Sent: Wednesday, September 23, 2009 2:19 AM  
To: ironruby-core  
Subject: [Ironruby-core] code coverage of ironruby code

Hi

Is there a way to get the code coverage when running RSpec or Test::Unit  
stuff with ironruby? It would help me a lot to set build tresholds etc.

Because I guess the C# tools won’t be able to do it and the ruby tools  
neither.

Is it in the cards? What would it take to implement something like that  
for IronRuby?

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))

---

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [September 23, 2009, 6:46pm UTC](https://www.ruby-forum.com/t/code-coverage-of-ironruby-code/175985/3 "2009-09-23T18:46:05Z")

</div>

rcov can spit out junit xmlI’m sure it can spit out the xml we want.

Ideally rcov would be ported and usable for both C# and ruby code when  
executing tests. Seeing how many people are trying cucumber on ironruby  
it  
could be a good thing to have early on.

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
GSM: +32.486.787.582  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))

On Wed, Sep 23, 2009 at 6:15 PM, Thibaut BarrÃ¨re

---

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [September 23, 2009, 6:16pm UTC](https://www.ruby-forum.com/t/code-coverage-of-ironruby-code/175985/4 "2009-09-23T18:16:12Z")

</div>

Maybe we’d have to mix tools to munge the profiling data and provide a  
uniformised set in return.  
Like:

- vsinstr + a port of rcov for windows
- mono profiler + port of rcov again on mac / linux

just a thought, but from a user perspective I am definitely interested  
to  
see a mix of C# and Ruby stacks into one view.

That’s a project on its own though 🙂

– Thibaut

On Wed, Sep 23, 2009 at 6:09 PM, Tomas M. \<

---

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [September 23, 2009, 6:57pm UTC](https://www.ruby-forum.com/t/code-coverage-of-ironruby-code/175985/5 "2009-09-23T18:57:47Z")

</div>

Anyone out there interested in tackling this? I know Ivanâ€™s busy, but  
someone out there might have time â˜º

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Ivan Porto  
Carrero  
Sent: Wednesday, September 23, 2009 9:45 AM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] code coverage of ironruby code

rcov can spit out junit xml  
I’m sure it can spit out the xml we want.

Ideally rcov would be ported and usable for both C# and ruby code when  
executing tests. Seeing how many people are trying cucumber on ironruby  
it could be a good thing to have early on.

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
GSM: +32.486.787.582  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))

On Wed, Sep 23, 2009 at 6:15 PM, Thibaut BarrÃ¨re  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:  
Maybe we’d have to mix tools to munge the profiling data and provide a  
uniformised set in return.

Like:

- vsinstr + a port of rcov for windows
- mono profiler + port of rcov again on mac / linux

just a thought, but from a user perspective I am definitely interested  
to see a mix of C# and Ruby stacks into one view.

That’s a project on its own though 🙂

– Thibaut

On Wed, Sep 23, 2009 at 6:09 PM, Tomas M.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\>  
wrote:

If you want to get coverage numbers for C# code you should be able to  
do:

set PERF\_TOOLS=%VSINSTALLDIR%\Team Tools\Performance Tools

set DSTDIR=an empty directory to store dlls you want to instrument to  
(the tests must load them from here)

# instrument each dll for which you want to get the coverage numbers

“%PERF\_TOOLS%\vsinstr.exe” /coverage /outputpath:%DSTDIR% your.dll

# start code coverage service:

“%PERF\_TOOLS%\vsperfcmd.exe” /start:coverage /OUTPUT:report\_file

# run your unit tests here

# stop code coverage service

“%PERF\_TOOLS%\vsperfcmd.exe” /shutdown

Open report\_file.coverage in VS.

Tomas

From:  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
On Behalf Of Ivan Porto C.  
Sent: Wednesday, September 23, 2009 2:19 AM  
To: ironruby-core

Subject: [Ironruby-core] code coverage of ironruby code

Hi

Is there a way to get the code coverage when running RSpec or Test::Unit  
stuff with ironruby? It would help me a lot to set build tresholds etc.

Because I guess the C# tools won’t be able to do it and the ruby tools  
neither.

Is it in the cards? What would it take to implement something like that  
for IronRuby?

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)
