I have a .NET solution that contains some Service Fabric library projects (.NET Standard 2.0) that are published as nuget packages. The unit-test projects in the solution (.NET Core 2.0) are using xUnit.
I noticed the tests are taking too much time when running on the build server, comparing to previous builds.
I tried running the tests in my local machine using Reshaper/Visual Studio or a powershell script and it takes less than 5 minutes:
$stopwatch = [system.diagnostics.stopwatch]::StartNew()
Get-ChildItem -recurse *tests.csproj | % {
dotnet test $_.FullName --no-build --no-restore;
}
$stopwatch.Stop()
Write-Host $stopwatch.Elapsed
But in Azure Devops the unit-testing task took more than 27 minutes to finish!!!
This is the Build pipeline/unit test task:
Any idea on what is going on?
Found a solution in Regression: dotnet test hangs for 15 minutes after test run completed on mac and linux.
Adding the following parameter to the arguments of the dotnet build
task did the trick:
-nodereuse:false
BTW the build agents are Windows machines, not mac or linux as mentioned in the above issue.