

Select the Object Creation warning category.

However, this may not be the type that you want to use for testing. In order to unit test this method, a concrete instantiation of this type is required. Browsing through the code, we can discover that IQueryDataStore is the type returned by the getter from the QueryDataStore property on the base class BaseHandler. The first warning is a Runtime Warning, and it indicates that IntelliTest has discovered, and will use, “ .QueryDataStore“ as IQueryDataStore. In addition, there are 2 warnings reported. Task 2: Understanding IntelliTest WarningsĪfter IntelliTest runs, only one test is generated and there is low coverage of the code (6/42 blocks). Right-click somewhere within the Handle method and then select IntelliTest | Run IntelliTest. Our goal with this demonstration is to enable IntelliTest reach 100% code coverage on the Handle method. As with most real-world code, this code interacts with other objects and layers. When a Game is deleted, this method is responsible for updating the stats of the affected players. Scroll down and locate the Handle method that takes a GameDeletedEvent parameter (around line 31). In Solution Explorer, search for GetPlayerStatisticsHandler.cs in the search box and then open the associated file in the code editor. All user passwords are P2ssw0rd.įrom the Start Page, open PokerLeagueManager.sln. This workflow is similar to what we would use while working with IntelliTest, as you will see in this exercise.

In practical terms, white box unit test development includes an iterative workflow informed by code coverage - write a unit test, see what parts of the code are not covered by the test, write more tests to cover those parts, repeat until all of the code is covered. Click the button below to launch the virtual machine on the Microsoft Hands-on-Labs portal.Īlternatively, you can download the virtual machine from here. In order to complete this lab you will need the Azure DevOps Server 2019 virtual machine provided by Microsoft.

As you change your code, rerun IntelliTest to keep the generated tests in sync with your code changes. You can select which of the generated tests to save into a test project to provide a regression suite. When you run IntelliTest, you can easily see which tests are failing and add any necessary code to fix them. This analysis is used to generate test data for a parameterized unit test for each of your methods, creating unit tests with high code coverage. For example, if statements, assertions, and all operations that can throw exceptions are analyzed. A case analysis is performed for every conditional branch in the code. For every statement in the code, a test input is generated that will execute that statement. NET code to generate test data and a suite of unit tests.
