mardi 1 septembre 2015

obtaining code coverage from command line

I have been using Visual Studio 2012 where I run tests by using Test explorer and obtain coverage xml. Now as I want to do this from command line I am using vstest.console.exe. I have my code in a file called chatserver.exe whereas my tests are present in chatserver.tests.dll. And I use the following command.

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow>vstest.console.exe chatserver.exe chatserver.tests.dll /InIsolation /EnableCodeCoverage

And coverage file I have obtained is

<results>
<modules>
<module name="chatserver.tests.dll" path="chatserver.tests.dll" id="1AE5956E7387E748969598A7B606CFB503000000" block_coverage="42.86" line_coverage="50.00" blocks_covered="3" blocks_not_covered="4" lines_covered="2" lines_partially_covered="0" lines_not_covered="2">
<functions>
<function id="8272" token="0x6000001" name="TestNoExceptionIsThrownByMethodUnderTest()" type_name="ChatServerTests" block_coverage="42.86" line_coverage="50.00" blocks_covered="3" blocks_not_covered="4" lines_covered="2" lines_partially_covered="0" lines_not_covered="2">
<ranges>
 <range source_id="0" covered="yes" start_line="14" start_column="17" end_line="14" end_column="49"/>
 <range source_id="0" covered="no" start_line="16" start_column="13" end_line="16" end_column="33"/>
 <range source_id="0" covered="no" start_line="18" start_column="17" end_line="18" end_column="78"/>
 <range source_id="0" covered="yes" start_line="20" start_column="9" end_line="20" end_column="10"/>
 </ranges>
 </function>
 </functions>
<source_files>
 <source_file id="0" path="e:\Workspace\visual studio 2013\Projects\ChatApplication\ChatServer.Tests\ChatServerTests.cs"/>
 </source_files>
 </module>
 </modules>
 </results>

The functions that are present in chatserver.exe and their coverage details are not listed. Coverage XML obtained from visual studio will look like this (http://ift.tt/1Jzx5ZZ)

Is there anyway to obtain same kind of coverage xml from command line??

Aucun commentaire:

Enregistrer un commentaire