问题
I just added a MSTest .NET Core unit test project to a solution in VS 2019 but there now don't appear to be any features for adding a new unit test file to that project.
Missing Add > Unit test... context menu option
Steps to reproduce missing context menu issue:
- In Visual Studio 2019, add a new 'MSTest Project (.NET Core)' project to an existing solution
- Right click on the name of the new test project in Solution Explorer
- See if the option for 'Add > Unit test...' is present?
That option, which was present in earlier versions of VS (and that's still present in VS2019 for full unit test projects targeting the full .NET framework projects) is missing for me:
Missing unit test templates
Steps to reproduce missing unit test template issue:
- In Visual Studio 2019, add a new 'MSTest Project (.NET Core)' project to an existing solution
- Right click on the name of the new test project in Solution Explorer
- Select 'Add > New item...'
- See if there are any C# related testing options?
I'm not seeing any unit test templates whatsoever:
What I've tried
I thought the issue might be that I hadn't got the unit testing workload installed for VS2019, but looking at the 'Individual components' option in the Visual Studio Installer for VS2019 the option for 'Testing tools core features' seems to have disappeared too:
These are the same options for VS2017 for comparison:
I know that the 'Create Unit Test' context menu option is not expected to be present in VS2019 yet, but to my knowledge the normal unit testing functionality and templates should be there?
(PS: I appreciate I can just write unit tests from scratch, I'm just asking if the functionality in VS has changed)
来源:https://stackoverflow.com/questions/55703609/unit-testing-features-missing-for-net-core-in-vs-2019-and-visual-studio-install