Running Selected Test on Visual Studio Not Working with NUnit Test Adapter
See original GitHub issueHi all, I was trying to run NUnit tests from Visual Studio Test Explorer today by selecting a test. But it kept running all tests of the project instead of the selected one. Same issue persists on debug too.
I was able to workaround it by changing the DiscoveryMethod in .runsettings file to Legacy. I think this is a bug of default DiscoveryMethod.
NUnit Version: 3.0.1 NUnit3TestAdapter: 4.1.0 Visual Studio: 2019 v16.8.1 Community Edition .NET Target Framework Version: 4.5.1
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
visual studio 19/22 Nunit test doesn't run by nunit adapter
Go to Extensions -> Manage Extensions , click Online and search and install. You might be asked to restart Visual Studio. AFAIK You...
Read more >nunit tests discovered but not running
Hi, I have NUnit 3.12 and Nunit3TestAdaptor 3.15.1 installed, using VS2019 community. I am able to discover the tests in the test explorer...
Read more >NUnit tests is not found or do not run in Visual Studio's ...
Almost always when I face this issue, the problem is that the project does not have any Test Adapter or Runner installed, and...
Read more >Running Tests with the NUnit Visual Studio Adapter - Alteridem
The second option is to go to the Tools | Extensions and Updates menu in Visual Studio. From here, click on Online and...
Read more >Run unit tests with Test Explorer - Visual Studio (Windows)
If Test Explorer is not visible, choose Test on the Visual Studio menu, choose Windows, and then choose Test Explorer (or press Ctrl...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for the repro, I do see the same behavior. But, this is actually caused by the NUnit version. If you update to the latest 3.13.2 version, you will find it works as it should.
There are three (actually more, but this holds in this case) components involved, the adapter, the engine - which is embedded with the adapter, and the framework. There is no guarantee that all possible combinations of these works. There is an interesting read on this on Charlies blog. There has also been significant changes between some of the versions here, so seeing this with adapter 4.1 runnings against NUnit 3.0 is not very surprising. That is also the reason for the Legacy discovery method, we did expect that something old could break. You were just one who found one example of that 😃
I would suggest you find a way to upgrade the framework. The version 4 adapter will probably in some time be bound to specific NUnit framework versions. There should be no need to stay on earlier versions of the framework. Are there any specific reason for staying on version 3.0 ?
@OsirisTerje I tried with Real Time Discovery option turned on and off. The result was the same.
Yeah, I know about the NUnit version. But unfortunately cannot do much about it at the moment.
I will try uploading a repro project and share the GitHub link here.