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

Notification

Icon
Error

NCrunch was unable to locate this test during NUnit's execution run.
dariusdamalakas
#1 Posted : Monday, July 10, 2017 10:36:42 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 1/10/2013(UTC)
Posts: 42
Location: Lithuania

Thanks: 4 times
Was thanked: 5 time(s) in 5 post(s)
This is getting annoying, have seen this many times over last few weeeks.

"NCrunch: This test was executed on server '(local)'

NCrunch was unable to locate this test during NUnit's execution run. This problem can be caused by tests with names that contain random elements, such as through the use of NUnit's RandomAttribute. Please ensure your test is named consistently or consider changing your 'Framework utilisation type for NUnit' solution-level configuration setting to 'StaticAnalysis'.
"

NCrunch 3.9.0.1
VS 2015

Framework utilisation type for NUNit v2: use static Analysis. Effective value: UseStaticAnalysis.


It is annoying that clicking `resynchronise` does not make this go away. The only thing that makes this go away is to make a chaneg to a unit test in question to force to recompile.



My test names do not have random elements, here's an example of the test that is currently showing this error:

[TestCase("")]
[TestCase(null)]
[TestCase("random")]
[TestCase("9999999999999999999999999999999999999999")]
[TestCase("-1")]
public void When_Something(string lifetime) {}



dariusdamalakas
#2 Posted : Monday, July 10, 2017 10:37:45 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 1/10/2013(UTC)
Posts: 42
Location: Lithuania

Thanks: 4 times
Was thanked: 5 time(s) in 5 post(s)
Any other info i could send to help solve this?
Remco
#3 Posted : Monday, July 10, 2017 12:00:26 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for sharing this problem.

Although changing your framework utilisation type to static analysis is recommend in the error message (as sometimes this works), static analysis is considered to be generally less compatible than dynamic analysis under NUnit. Especially so when dealing with TestCase.

The error message given by NCrunch is usually caused by tests that cannot be easily identified between different test processes. You'll find a more detailed explanation of this problem here - http://www.ncrunch.net/documentation/considerations-and-constraints_unique-test-names.

Upgrading your NUnit to V3 has a chance of solving this problem as NCrunch's NUnit adapter was completely rewritten for V3 and uses a very different integration approach.

I'm having difficult in reproducing this problem using the sample test declaration you've provided. I have the feeling there may be more to this issue than just the declaration itself. Does this problem appear consistently? Are you able to reproduce it in a sample solution?
dariusdamalakas
#4 Posted : Tuesday, July 11, 2017 5:58:02 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 1/10/2013(UTC)
Posts: 42
Location: Lithuania

Thanks: 4 times
Was thanked: 5 time(s) in 5 post(s)
No, its not consistent, and i have no idea how to reproduce this. It is happening couple times a day, but i cant tell under what conditions this is happening.
The only sure thing i can is that this issue is introduced in the newer versions of NCrunch. Previously i have not seen this, i have used NCrunch for long time. NCrunch 2.x didnt have this, hence I am pretty confident that this is a defect, and not an issue of components outside of NCrunch. Upgrading to NUnit 3 is not an easy task, as I work in a software house where we have 50+ projects + CI/CD pipelines, so this would have to be upgraded consistently across the board.

p.s. this is also happening for tests marked with [Test] attribute, not only [TestCase] - it is this that is strange. The explanation implies that test names are somehow dynamic, but tests with [Test] attribute are clearly static. I will post more details when i see this error.

p.p.s. what would be good at least is that 'resyncrhonize' would make this go away. However, it does not. I have no clue of NCrunch internals, but it seems that even resyncrhonize rebuilds the projects, a list of NUnit test names is not re-initialized and thus still show this error message. However, if i modify the actual code of the impacted unit test, then test re-name is rebuild and all works fine. It is this manual step that is annoying, it would be less painful if rebuild would reinitialize NCrunch completely.
Remco
#5 Posted : Tuesday, July 11, 2017 6:57:02 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Are you using a SetUpFixture of any kind?

It seems like something is going wrong inside the NUnit environment itself. Would you be able to submit a bug report immediately after the issue appears?
dariusdamalakas
#6 Posted : Monday, July 17, 2017 7:11:25 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 1/10/2013(UTC)
Posts: 42
Location: Lithuania

Thanks: 4 times
Was thanked: 5 time(s) in 5 post(s)
Good point - yes, we do use SetUpFixture. Sets up logging, and some other static properties. Do you think this would have an impact in certain situations?
Remco
#7 Posted : Monday, July 17, 2017 7:16:02 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
dariusdamalakas;10777 wrote:
Good point - yes, we do use SetUpFixture. Sets up logging, and some other static properties. Do you think this would have an impact in certain situations?


It depends upon the behaviour you have coded in here, but I can tell you that if the code in a SetUpFixture fails, it can interrupt the NUnit invocation and prevent NCrunch from receiving data from tests inside the run, giving the error message you're receiving.

It's possible that you have logic in your SetUpFixture that is sequence dependent (i.e. depends on other tests run earlier in the process). Note that under NCrunch, a SetUpFixture can be executed multiple times per test process, because the engine will call into NUnit for each execution batch and each process can be re-used by NCrunch any number of times.

Under NUnit v2, NCrunch's handling of errors and results inside SetUpFixtures is not particularly good. This can make it quite hard to troubleshoot failure scenarios. You might want to look into setting up an exception trap inside the SetUpFixture so that if it blows up, you can be notified of it. Placing System.Diagnostics.Debugger.Launch(); inside the exception handler will allow you to get a debugger on the situation.
dariusdamalakas
#8 Posted : Monday, July 17, 2017 7:24:47 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 1/10/2013(UTC)
Posts: 42
Location: Lithuania

Thanks: 4 times
Was thanked: 5 time(s) in 5 post(s)
Thanks, i'll try this this. Will log the exception in a catch block and add the line to start debugger. Will let you know how it goes.
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.047 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download