I created an MVC3 application from the Empty template so I couldn´t add a Visual Studio Unit test project to the solution.
I made some changes, added some controllers and now I want to try TDD so I need to add a framework for testing.
But I can´t see how I can do that.
I want some way where I can create my test project right in the Solution Explorer, for example "website.Test" with some basic folders and files.
I saw here some questions about how to add Unit tests, but those were with xUnit.net or NUnit and I want the original VS test framework.
I am using Visual Studio 2010 Professional.
I am also interested to know what others think about the 3rd-party unit test frameworks, are they better?
What about for beginners?
Select the test project in Solution Explorer. On the Project menu, select Add Reference. In Reference Manager, select the Solution node under Projects. Select the code project you want to test, and then select OK.
To add a unit test target to an existing Xcode project, choose File > New > Target. Select your app platform (iOS, macOS, watchOS, tvOS) from the top of the New Target Assistant. Select the Unit Testing Bundle target from the list of targets.
To add an empty Test project just go to File>Add>New Project choose Test subcategory > Test Project.
The naming of the test-project is significant! If your MVC-project is named "MyProject" your test-project has to be named "MyProject.Tests" in order to connect both of them. Tools like MvcScaffolding will not work otherwise!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With