Reputation: 28121
I have a solution with a few nunit test assemblies and several more in the works.
Right now, I'm running my nunit command in my msbuild file like so:
<Exec Command="nunit-console src\Assembly1.Tests\bin\Debug\Assembly1.Tests.Tests.dll src\Assembly2.Tests\bin\Debug\Assembly2.Tests.Tests.dll src\Assembly3.Tests\bin\Debug\Assembly3.Tests.Tests.dll src\Assembly4.Tests\bin\Debug\Assembly4.Tests.Tests.dll" />
Clearly this is unreadable and sucks. So the question is how do I improve this? Specifically:
foreach(var assembly in testAssemblies) string.Format("src\\{0}\\bin\\debug\\{1}", assembly)
Upvotes: 2
Views: 1113
Reputation: 4533
Think the highest ranked answer on this question has what you need.
Specifically the target filter that allows you to specify all assemblies but also specify name filtering if there's some you don't want to run:
<Target Name="GetTestAssemblies">
<CreateItem
Include="$(WorkingDir)\unittest\**\bin\$(Configuration)\**\*Test*.dll"
AdditionalMetadata="TestContainerPrefix=/testcontainer:">
<Output
TaskParameter="Include"
ItemName="TestAssemblies"/>
</CreateItem>
Upvotes: 2