CC.NET: parallelize NUnit tests

We have 3 unit test dlls that take 1 hour to complete (30, 20 and 10 minutes each). Ran at the same time, it takes no more than 30 minutes.

Do you know if it is possible and how to parallelize NUnit execution in CC.Net or "inside" the NUnit process:

  • run 3 dll in that time

or,

  • run many tests in 1 DLL as parallel processes
+4
source share
3 answers

You can use parallel tasks to run multiple NUnit processes in parallel.

0
source

If you are using NUnit, try:

Also see this SO answer in the same thread for some other ideas:
How to run NUnit parallel tests?

+1
source

We ended up running tests in parallel through MSBuild, and then merging the resulting (several) test results files into one file for ease of reporting - CC.Net would be happy to do this for you on the build server, but it’s nice that the developers also have significant results on their own cars.

An example code looks something like this:

<Target Name="UnitTestDll"> <Message Text="Testing $(NUnitFile)" /> <ItemGroup> <ThisDll Include="$(NUnitFile)"/> </ItemGroup> <NUnit ToolPath="$(NUnitFolder)" Assemblies="@(ThisDll)" OutputXmlFile="$(TestResultsDir)\%(ThisDll.FileName)-test-results.xml" ExcludeCategory="Integration,IntegrationTest,IntegrationsTest,IntegrationTests,IntegrationsTests,Integration Test,Integration Tests,Integrations Tests,Approval Tests" ContinueOnError="true" /> </Target> <Target Name="UnitTest" DependsOnTargets="Clean;CompileAndPackage"> <Message Text="Run all tests in Solution $(SolutionFileName)" /> <CreateItem Include="$(SolutionFolder)**\bin\$(configuration)\**\*.Tests.dll" Exclude="$(SolutionFolder)\NuGet**;$(SolutionFolder)**\obj\**\*.Tests.dll;$(SolutionFolder)**\pnunit.tests.dll"> <Output TaskParameter="Include" ItemName="NUnitFiles" /> </CreateItem> <ItemGroup> <TempProjects Include="$(MSBuildProjectFile)"> <Properties>NUnitFile=%(NUnitFiles.Identity)</Properties> </TempProjects> </ItemGroup> <RemoveDir Directories="$(TestResultsDir)" Condition = "Exists('$(TestResultsDir)')"/> <MakeDir Directories="$(TestResultsDir)"/> <MSBuild Projects="@(TempProjects)" BuildInParallel="true" Targets="UnitTestDll" /> <ItemGroup> <ResultsFiles Include="$(TestResultsDir)\*.xml" /> </ItemGroup> <NUnitMergeTask FilesToBeMerged="@(ResultsFiles)" OutputPath="$(MSBuildProjectDirectory)\TestResult.xml" /> </Target> 
+1
source

Source: https://habr.com/ru/post/1391428/


All Articles