Skip to content

Instantly share code, notes, and snippets.

@topas
Created April 10, 2011 19:59
Show Gist options
  • Save topas/912672 to your computer and use it in GitHub Desktop.
Save topas/912672 to your computer and use it in GitHub Desktop.
Code coverage generation script for VS2010 and xUnit, NUnit, etc.
@echo off
set curdir=%~dp0
set outputdir=.\bin\
set xunitfile="xunit.console.clr4.x86.exe"
set instr="c:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Performance Tools\VSInstr.exe"
set perfcmd="c:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Performance Tools\VSPerfcmd.exe"
mkdir %outputdir%
del %outputdir%*.dll %outputdir%*.orig %outputdir%*.pdb %outputdir%*.exe %outputdir%*.config %outputdir%*.coverage
copy ..\XXX.Tests\bin\Debug\*.dll %outputdir%
copy ..\XXX.Tests\bin\Debug\*.pdb %outputdir%
copy ..\xUnit\%xunitfile% %outputdir%
copy ..\xUnit\%xunitfile%.config %outputdir%
copy ..\xUnit\xunit.runner.utility.dll %outputdir%
rem List of code assemblies
%instr% %outputdir%XXX.dll /COVERAGE
%perfcmd% /start:COVERAGE /OUTPUT:%outputdir%Project.coverage
rem Run tests (xUnit, NUnit, etc...)
pushd %curdir%
cd %outputdir%
%xunitfile% XXX.Tests.dll
popd %curdir%
%perfcmd% /SHUTDOWN
call %outputdir%Project.coverage
@echo on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment