How to run nunit with msbuild from VS2010
Asked Answered
C

1

18

please tell me how to run nunit with msbuild. I am using TFS for code integration and VS2010 .

Columnar answered 5/1, 2011 at 14:40 Comment(0)
A
19

You probably want to integrate NUnit with TFSBuild and not MSBuild since you are using Team Foundation Server.

You will need MSBuild tasks to be able to run NUnit as explained in the three following tutorials:

The easiest way is to use the MSBuild Community Tasks where you already have a NUnit task ready to be used and you only will need to add a target to your msbuild file like so:

<Target Name="RunTests">  
    <!-- Run Unit tests -->  
    <CreateItem Include="$(OutDir)*.Tests.dll">  
      <Output TaskParameter="Include" ItemName="TestAssembly" />  
    </CreateItem>  
    <NUnit ToolPath="..\Tools\NUnit" DisableShadowCopy="true" Assemblies="@(TestAssembly)" />  
  </Target>
Adjure answered 5/1, 2011 at 14:54 Comment(3)
I don't understand your question. Did you read the tutorials? Did you install the MSBuild Community Tasks and try out the NUnit task?Adjure
I installed MSBuild Community Tasks and imported it <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/> but i am getting invalid nunit elementColumnar
Try the following page (translated from German), it includes Sample code (msbuild file) you can directly run: bit.ly/fIpjszAdjure

© 2022 - 2024 — McMap. All rights reserved.