Now let us try to understand how we can create a test project in Visual studio.
Open up Visual Studio and click on New project. In new project window, you have to select unit test project as shown in below image.
It will create a new test project as shown in below image.
As shown in above image, we have created a simple test method called as TestMethod1.
You can run unit tests in 3 ways.
- Right click on the method and run it.
- Using test explorer.
- Using command line – MSTest and VSTest.
Below image shows how to run tests from IDE.
Below image shows test explorer in visual studio.
To run tests using MSTest, you will have to use command as shown in below image.