Create a Unit Test Project

Use this process if you are writing the application logic from scratch, or are importing it from elsewhere. If the application logic that you plan to test already exists, you may find that the process explained in Create a Unit Test Project and Test Program for Existing Code is better. For ease of use, we recommend that you organize your solution/projects as described in Organizing Your Projects when using this process.
Note: The following instructions are applicable to Visual Studio 2019; if you use another version of the IDE, the instructions may vary slightly.
  1. From the Visual Studio IDE, click File > New > Project.
  2. In the Create a new project dialog box, click Down arrow icon on the All Project Types filter and select Test.

    The list of available projects filters on test projects.

  3. Select the Unit Test Library project template.
  4. In the Project name field, specify a name for the project.
  5. Specify where to create the project:
    • To create the project in a new solution, leave the Solution field set to Create new solution, and enter a name in the Solution name field.
    • To add the project to an existing solution, click Create new solution and select Add to solution from the list displayed, then select the required solution.
  6. Click Create.
You now need to add a test program to the project to start creating test cases.