nunit / nunit-vs-testgenerator

A Visual Studio extension for generating unit tests and IntelliTests using NUnit
https://visualstudiogallery.msdn.microsoft.com/bd30bf3f-4183-4b00-a245-1875316b8cd3
MIT License
35 stars 23 forks source link

nUnit not in Create Unit Tests dialog #36

Closed jhuddle61 closed 1 year ago

jhuddle61 commented 4 years ago

I can get to the Create Unit Test dialog but the only options are MSTest and MSTestv2. I have tried with nUnit 3.12 nuget package installed and have tried backing off to 3.01 to no avail. What needs to be installed for this extension to work? (VS 2019 16.2.2)

PhilippFlach commented 4 years ago

I can confirm that I also received the same issue as @jhuddle61 . In my case the issue still persists in Microsoft Visual Studio Professional 2019 Version 16.5.4 It seems to me that the Create Unit Test dialog with the nUnit is working only using the nunit-vs-testgenerator on VS 2017 but not on VS 2019.

rprouse commented 4 years ago

Thanks for the report. The original code was contributed by Microsoft to the NUnit project and none of us are maintaining it. Pull requests or help would be welcome...

OsirisTerje commented 4 years ago

@jhuddle61 @PhilippFlach I can't repro this. It works in VS 2019.

Just one thing to be aware of: Do you use it from your non-test code? If you use it on a test method, there is a bug in the MSTest implementation that allow it there. It should not. This method should be used from the software-under-test itself.

PhilippFlach commented 4 years ago

@OsirisTerje : Thanks for your post. Indeed, it works if I create a fresh NUnit Testproject. In the case I mentioned on 16 April I was using a solution that I was working with Visual Studio 2019 (at home) and Visual 2017 (at work). This means creating test cases using VS 2017 an Test Generator worked. However when I called the Create Unit Test dialog on Visual Studio 2019 the same way at home (using VS 2019) as I did at work (using VS 2017) did not allow me to add NUnit test cases. My recommendation in such situations is to setup the solution with a new Nunit Testproject using VS 2019 from beginning. Then it will work. Anyway thanks and kind regards, Phil.

Mudoch commented 3 years ago

Just returned to project I had been working on back in Dec. I have updated VS2019 to latest and could not add more testcase through right click on method. Cause was VS2019 update. Had to reinstall Test Generator NUnit Extension.. All good after that.