-
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
Test Explorer Picks up Zero Tests in VS 2017 for NUnit 2 #178
Comments
Try using |
The above This test case is a programmer's test from a company and they say that you have to create what is needed to pass all of the tests. They make clear to NOT change anything in the test, it's not a trick, the test works. They say to use NUnit 2.x due to the deprecation of some |
And actually, if I change |
When you say "picked up" do you mean the tests are discovered? That is, they are listed by the explorer? Are they always discovered? Then when you run the test, they are shown as not run? It's important to think about discovery and execution separately, since they are really separate. BTW using TestCase with no args is risky. It's one of those "accidental" features and may work in some versions of nunit and not others. |
I just tried my NUnit Test Project that I use for testing reported issues. It has NUnit 2 and 3 tests in it and it was working in earlier versions of Visual Studio, but tests are no longer appearing for me either. I am going to move this issue to the NUnit Adapter repository and continue to investigate. Visual Studio has been making a lot of changes recently and has likely broken the adapter with a recent update. One change that they have made is to require adapters to be copied into the bin directory which this version of the adapter does not do. I will test, but in the meantime, you could run your tests using the NUnit Console, or installing the VSIX version of the adapter might work. |
I tested in Visual Studio 2019. Tests are discovered, I think by Visual Studio, not by the adapter, but tests are not run. In the output window, it looks like only the 3.11 version of the adapter is being called. |
I managed to get it to work. To do so, I had to go to Tools | Options | Test | General and uncheck the Active Solution performance checkbox. I then had to rebuild the solution. Once I did that, tests appeared and the NUnit 2.1.1.0 adapter started being listed in the output window. I believe the VSIX would also work. If we want to fix this issue, I think we will need to move the adapter into the bin directory from the NuGet package like we did with the NUnit 3 adapter. |
Thanks @CharliePoole for the insight, I think they have been discovered by the test explorer because they would show up but not execute. However, the solution that @rprouse suggested worked. I turned off the setting outlined above and I'm now stepping through the tests. So I'll use this solution for now. I was given specific instructions to change nothing in the test case given so I have to use what's there but I'm sure that's not what they use in their main day. |
I don't know if my issue is the same, but unchecking that box did not work for me. All of my tests are discovered by the Test Explorer, but when I try to run any of them I get "No test matches the given testcase filter...". I'm using the VSIX adapter. ReSharper is able to run the tests no problem, but I can't run them without it.
|
@vaindil Ok, I'll try to take a look at it. If you by any chance have a small repro that compiles "as is", it would be awesome. |
i have similar issue. My configuration is Visual studio 2017 9.11 When try discovery the test in output window show this messages: I tried to downgrade the adapter to 2.0.0.0. |
@workgroupengineering Can you upload a small repro ? |
@OsirisTerje Here is an example repository. |
@workgroupengineering Thanks for the repo. The issue is caused by using the new SDK style project format. If you create the project with the Traditional style project format (either packages.config or package reference, both should work), then it works. I tested it out with such a project and then it finds the adapter and runs correctly. |
Thanks @OsirisTerje, |
NUnit3 is compatible with .net 3.5. It is not compatible with 2.0, but 3.5 works. And, I just checked it again on the project, updated to 3.11 framework and 3.13 adapter, and it works. Also, the test projects could well be running under a higher framework, even if the SUT is targeting 3.5. |
@workgroupengineering When you say it works with 2.0 and not 2.1, that is the framework, which should not affect this at all. Did you use the same adapter version in both cases ? |
@workgroupengineering why do you say that NUnit 3 is not compatible with .NET 3.5? NUnit 3 has always had .NET 3.5 targets. In fact, until the upcoming 3.12 release, it still has .NET 2.0 targets. |
Hi @rprouse |
Thanks @workgroupengineering. It should work, our NUnit tests target everything from .NET 3.5 to .NET Core and run fine. If you can create a repro for us, we can look at it for you. |
@rprouse See my answer above, #178 (comment), and if you want to have another look, check his repro here https://github.com/workgroupengineering/Issue178 I have also forked his repro and added the Traditional style, see https://github.com/OsirisTerje/Issue178, branch FixNUnit. :-) |
@rprouse after update VS at 15.9.2 the issue is resolved |
@workgroupengineering @DanJ210 Just released 2.2 of the adapter. It should work with these now. See details here: http://hermit.no/new-version-of-the-nunit-2-adapter-supporting-visual-studio-2019/ |
Where can I find a sample for NUnit 2? I have to use it for something but have spent the entire day trying to get it to work with zero success.
I can get NUnit 3 to work and with this sample but NUnit 2 just finds zero tests. I've installed NUnit framework 2.6.1 - 2.7 with the NUnitTestAdapter 2.0 - 2.1.1 trying all possible combinations. Below is my
[TextFixture]
and my[TestCase]
which is an NUnit 2.0 syntax as shown below. I've searched all day and have tried every suggestion but no matter what I've not been able to get tests picked up using NUnit 2.The text was updated successfully, but these errors were encountered: