-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests become undiscoverable until rebuild #110
Comments
Is this the NUnit3 adapter, as per the SO question you've linked to? Which version of the adapter are you using? The issue in that StackOverflow question was fixed in nunit/nunit3-vs-adapter#126, and should be fixed in v3.0.10 of the adapter. If you're on that, it may be a separate issue. |
I'm actually using NUnit 2.6 on NUnitTestAdapter.2.0.0, so maybe the fix was "just" not backported? |
I'm open to aid in resolving this issue. The issue on the NUnit3 adapter has no direct links to the code changes that comprehend the fix, which makes it a bit tough when you're not acquainted with the code base. Feel free to point me in any direction though. |
The bug under the NUnit 3 adapter was never actually worked on, which is why there is no code pointed to. Rather, there were a lot of changes going on at the same time and we basically discovered that it had been fixed by one of them. We never analyzed to figure out why. However, even if we had the code, we wouldn't necessarily "backport" it to the NUnit Adapter. The reason is that the two adapters are two different products and the code similarities are limited. The reason they are two products, btw, is that we wanted to keep supporting both of them with fixes as needed. Our practice for older releases of the same product is to stop supporting it in that way. So, we will need for somebody to confirm the bug, preferably by providing a reproducible case. Then somebody can pick it up and try to fix it. As a second front for attacking the problem, someone could go through the 40 or so commits we made to the NUnit 3 adapter between 3.0.8 and 3.0.9 and identify candidates for porting to this adapter. |
Ok, tnx for the info. I'll post a link here for my own reference purposes and for any extra pair of eyes that might want to have a look: |
It looks like the most important change was DiscoverTests which had a pretty straightforward refactoring comprising 2 changes. The first one takes the GetRunnerFor out of a try..finally block, and the second one is about the detection of missing fixtures:
became
Then, there's also a change on AsyncMethodHelper:
Became
|
I've got some more info on this issue, and a clue as to what might be happening. It seems that sometimes, after a build, the adapter kicks in before the whole bin is written. The effect is that the assembly is not read thus no tests are detected. However, eventually, the whole bin does get written, but only after the adapter has done it's scan. Subsequently, issuing a build again after applying no code changes, the project will not be rebuilt, hence the adapter will not try to scan the assemblies, because they have not changed. Making a code change to force a rebuild of the project solves the issue in that case. The following is output whenever the described scenario is happening.
|
If that's true, it seems like it must be a Test Explorer rather than an adapter bug. The adapter only starts discovery when it's called by VS. |
On the other hand, we think it was resolved for the NUnit 3 adapter due to some change made. Hmm... |
Unless it's actually a different bug? |
Fyi: I kept suffering from this on a consistent enough basis, that I switched to NUnit 3. The NUnit 3 adapter does not expose this behaviour, mabye thanks to the aforementioned fix. For me, it's a post mortem, but fwiw, this was my flow:
The last step would trigger a build of both the project and the test project. After the build, VS would have forgotten about my test, only to be resolved with a retest. Particularly in the case of dynamically parameterized tests, this was an issue, because it prevented me from running a specific test after a bug fix. |
I've got at least 2 solutions (1 with about 6 projects and another one with about 30 projects) in which this problem occurs. I use the NUnit NuGet adapter to run tests in VS 2015. During developing, every now and then, after a build, tests disappear from the Test Explorer. Only a subsequent rebuild fixes the issue.
It seems more people are suffering from this: http://stackoverflow.com/questions/35589927/why-do-nunit-tests-frequently-disappear-in-visual-studio-2015
The text was updated successfully, but these errors were encountered: