Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

NUnit3 / Teamcity TestExecutionException: Cannot start monitoring test...
royboy23
#1 Posted : Saturday, April 18, 2020 8:38:36 PM(UTC)
Rank: Member

Groups: Registered
Joined: 3/3/2014(UTC)
Posts: 21
Location: Germany

Thanks: 3 times
Hi,

I am working on a project with about 1500 Nunit tests and use Ncrunch on both my Dev machine and my Teamcity server. Since updating NUnit from 2.6.3 to version 3.12.0, I am having problems with my unit tests on the TeamCity Server.

The tests are still run and all are passing, however, I get lots of build errors such as this one:

nCrunch.TestExecution.TestExecutionException: Cannot start monitoring test 'Zeiterfassung.UnitTests.Model.HourlyRates.HourlyRatesViewModelTest.' - test Zeiterfassung.UnitTests.Model.HourlyRates.HourlyRateSummaryTests. is still being monitored
at nCrunch.TestExecution.TestExecutionMonitor.StartMonitoringTest(ExecutingTest test)
at nCrunch.TestExecution.ExecutingTest.Start()
at nCrunch.Module.NUnit3.Integration.NUnit3Listener.suiteStarted(NUnit3Message message)
at nCrunch.Module.NUnit3.Integration.NUnit3Listener.RaiseCallbackEvent(String eventArgument)

As a result, my Build is marked as failed in Teamcity.

I have no problems running the same tests in Visual Studio 2019 with NCrunch. The problems only occur in TeamCity.

Please let me know how to fix this.

Thanks,

Adrian

royboy23
#2 Posted : Saturday, April 18, 2020 8:40:55 PM(UTC)
Rank: Member

Groups: Registered
Joined: 3/3/2014(UTC)
Posts: 21
Location: Germany

Thanks: 3 times
Just in case it matters, this is the command from my TeamCity NCrunch build step:

"%system.teamcity.build.checkoutDir%\MySolutionName.sln" /c c:\globalconfig.crunch.v3.xml /o "%system.teamcity.build.checkoutDir%\NCrunchResults" -NCrunchCacheStoragePath C:\NCrunchTestRunnerCache

Thanks,

Adrian
Remco
#3 Posted : Sunday, April 19, 2020 12:39:27 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Adrian,

Thanks for sharing this issue.

This error appears when the sequence of events provided by NUnit is inconsistent. NUnit did not send a completion message for the previous fixture before it sent a message saying that the next test had started its execution (invalid sequence).

Are you using any NUnit plugins or modifications of any kind?

Do you have parallel execution turned on for NUnit? Note that there are several ways to do this (check them all).

Can you get a capture of the test run containing the error with LogVerbosity set to Detailed? You can submit this via the NCrunch contact form.
royboy23
#4 Posted : Sunday, April 19, 2020 8:52:42 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/3/2014(UTC)
Posts: 21
Location: Germany

Thanks: 3 times
Hi Remco,

thanks for the quick reply. The issue was that I had marked my test fixture base with [Parallelizable(ParallelScope.All)] . I thought Once I removed this, the problem on Teamcity went away. Naturally, my tests are not parallelized anymore when I use a different test runner, but usually Ncrunch is stable enough so that I don't have to do that.

Thanks again for your help!

Best Regards,

Adrian

P.S.: The new "Optimized" instrumentation mode is great! Well worth getting the update just for this feature :-)
Remco
#5 Posted : Monday, April 20, 2020 5:06:48 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Thanks for confirming that this was the problem!

I'm glad the new instrumentation mode is working well for you. I look forward to making this the default mode of operation in future :)
royboy23
#6 Posted : Friday, December 4, 2020 2:34:47 PM(UTC)
Rank: Member

Groups: Registered
Joined: 3/3/2014(UTC)
Posts: 21
Location: Germany

Thanks: 3 times
Hi Remco,

unfortunately the problem has reappeared, though I am not using the Parallelizable attribute. The error message is almost the same:

nCrunch.TestExecution.TestExecutionException: Cannot start monitoring test 'Zeiterfassung.Tests.Controllers.TimeEntrySearchControllerTest.' - test Zeiterfassung.Tests.Business.ProjectsServiceTest. is still being monitored

Unfortunately this caused my CI build to fail, even though my test are all passing. I changed my build step so that it uses -LogVerbosity Detailed, but once I did that the problem did not reappear in the next test run.

This is quite annoying since it causes my CI builds to intermittently fail even when all test are in fact passing. Is there any way to suppress this error so that the build is not marked as failed in my CI server?

Thanks,

Adrian
Remco
#7 Posted : Friday, December 4, 2020 10:50:10 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Adrian,

Unfortunately, suppressing this issue won't help here, as when tests results are reported out of order, NCrunch has no way to make sense of the results. The error invalidates the entire test run. You need to find out why NUnit is running your tests in parallel.

Make sure you are using the latest version of NUnit. Search your entire codebase for ParallelizableAttribute and ParallelScope. See here for a detailed guide on the configuration options available for this under NUnit, and make sure you don't have this configured. To my present knowledge, NUnit parallelisation is the only thing that can cause the error you've encountered.

If you're able to isolate the issue in a sample solution you can share with me, I'll be happy to trace the engine through it to understand what is going wrong.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.052 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download