MSpec and ASP.NET MVC Unit Test, Visual Studio Integration
-
12-10-2019 - |
Question
When one creates a new ASP.NET MVC project in visual studio, the New Project Wizard provides the option to create a unit test project at the same time. Typically, the only choice offered is MSTest, but I want to use MSpec. MVC is supposed to be pluggable, including for unit test frameworks, so I'd really like to be able to choose 'MSpec' from that wizard and have my MSpec project created alongside the MVC project.
Is anyone aware of an MSpec integration that's been done that lets users get going with MSpec right from the New Project Wizard?
Solution
There's no integration for the new project wizard as of today.
Creating a MSpec test project ist easy, so I would argue that there's no real benefit in having a new option in the project wizard:
- Download MSpec from the TeamCity server at CodeBetter
- Extract the zip
file to your project's
lib
ortools
folder - Create a new class
library and reference
Machine.Specifications.dll
- Write specs
- Run tests with ReSharper or TestDriven.Net (or use the console runner, but that's not really preferred)
OTHER TIPS
I don't know if it's been done already for MSpec, but below you'll find the instructions on how to get an MSpec option into the drop down.
How to: Add a Custom ASP.NET MVC Test Framework in Visual Studio
HTHs,
Charles