Test Method: To Run a Test Method

The following activity will walk you through the process of running a single test method.

Story

Suppose that you have a test method implemented in a test class. You need to run the test method.

Process Overview

In the Test Explorer window of Visual Studio, you will select a method and run it.

System Preparation

Before you begin running the test method, make sure that you have performed the following prerequisite activities:

  1. Test Instance for Unit Testing: To Deploy an Instance, to prepare the MYOB Acumatica instance that you will use
  2. Test Project and Test Class: To Create a Test Project, to create and configure the PhoneRepairShop_Code.Tests.csproj test project
  3. Test Project and Test Class: To Create a Test Class, to create the RSSVRepairServiceMaintTests test class
  4. Test Method: To Create a Test Method Without Parameters, to create the PreliminaryCheckAndWalkInServiceFlags_AreOpposite test method

Step: Running a Test Method

Tip: If your code contains test methods other than the one created in Test Method: To Create a Test Method Without Parameters, or if you have already run the existing test method before, the number of items mentioned in the following instruction may differ.

Do the following to run the method created in Test Method: To Create a Test Method Without Parameters:

  1. In Visual Studio, select the Test > Test Explorer menu item. The Test Explorer window opens, which currently displays no tests.
  2. Click Run All Tests In View. The solution is built, and one test for the PreliminaryCheckAndWalkInServiceFlags_AreOpposite test method appears in the Test Explorer window (shown in the following screenshot) and is run.
    Figure 1. The Test Explorer window with one test