How to test a driver at runtime using Visual Studio
The WDK extensions to Visual Studio provide a device testing interface that enables you to conveniently build, deploy, install, and test a driver on a test computer on your network. The WDK provides a collection of device driver tests that you can use to test the features and functions of your driver.
- A Driver Package that is ready to install. You must first create and build your driver and then create a Driver Package for installation. For more information, see Building a Driver and Creating a Driver Package.
- The driver must be test signed. For more information, see Signing a Driver.
- A test computer (or computers). The test computer must be on the same network as the computer that you are using for development. Both computers must be connected to the same domain, or both connected to the network under the same workgroup. The test computer should be running the version of Windows that you want to target for testing.
- A device to be tested.
- (Recommended) Set up a kernel mode debugging connection to the test computer. To use a network connection for kernel mode debugging, the target computer must be running Windows 8. On computers running Windows 7 or Windows Vista, you can set up a USB, 1394, or a serial connection for kernel mode debugging. For more information, see Provision a computer for driver deployment and testing (WDK 8.1).
Step 1: Configure computers for testing
From Visual Studio, you can configure and provision computers for testing. When you configure the test computers, the WDK driver test framework automatically enables the test computer for remote debugging and transfers the necessary test binaries and support files.
- If you have not already done so, follow the instructions to Provision a computer for driver deployment and testing (WDK 8.1).
- Connect the device that you want to test to the test computer or computers.
After you have configured and provisioned a test computer, you can use Visual Studio to deploy drivers, schedule tests, and debug drivers on the test computer. For information about deployment and about how you can deploy a driver automatically at build time, see Deploying a Driver to a Test Computer.
You can also enable and set options for Driver Verifier, the runtime verification tool for drivers. Driver Verifier monitors your driver as you run tests on the test computer. For information about setting the Driver Verifier options for deployment, see Driver Verifier Properties for Driver Projects.
You can also run tests outside of Visual Studio, for more information see How to test a driver at runtime from a Command Prompt. Starting in WDK 8.1, you can copy and run the HCK Test Suites on test computers using command scripts. See How to run the HCK Test Suites in WDK 8.1.
Step 2: Select an HCK Test Suite to run on the test computer (using WDK 8.1)
Starting with WDK 8.1, you can select HCK Test Suites to run on the test computer. The HCK Test Suites include the Device Fundamentals Tests, and Windows Hardware Certification kit (HCK) Basic tests for graphics, imaging, wireless LAN, mobile broadband (CDMA and GSM), and WiFi Direct devices.
Step 3: Select the tests to run on the test computer (WDK 8 and WDK 8.1)
To make driver testing on different test targets easier, tests are scheduled to run against test systems in units called test groups. A driver test group is a collection of tests that you select to run on the test computer. The driver test groups help you organize your tests and test results from each test pass. You can save your test results to separate folders. You can create and manage test groups, change parameters passed to the tests in the test groups, and schedule them to run against your test systems.
From the Driver menu, click Test and then select Test Group Explorer.
In the Driver Test Group Explorer window, click the Create a new test group button. Or, click New Test Group from the Driver menu.
In the Driver Test Group window for the group that you created, type a name in Test Group Name text box to identify the group. The default name is Driver Test Group_nnnnn, where nnnnn represents the number of the test group
Click Add/Remove Tests.
In the Add or Remove Driver Tests dialog box, you can specify the driver test category and architecture (All, x86, x64, ARM). By default all tests are shown. To view the test categories, click the folders in the Driver Test Categories drop-down list.
For example, in WDK 8, to select all of the Device Fundamentals tests that are used in the Windows Hardware Certification Kit (HCK), click All Tests, Certification, and Device Fundamentals. For information about the tests, see How to select and configure the Device Fundamentals Tests.
In WDK 8.1, the Device Fundamentals tests are under All Tests, HCK Tests, Certification, and Device Fundamentals folder. In WDK 8.1 the Driver Test Categories include the HCK (Basic) Tests. See How to run the HCK Test Suites in WDK 8.1 for more information.
Be sure that you select the tests that match the architecture of the intended test computer (x86, x64, ARM). Use the Architecture Filter to show only those tests that will run on your test computer.
Click >> to add the selected tests.
Step 4: Configure test parameters
After you select the tests for your test group, you can configure any of the runtime parameters that are passed to the driver tests. For example, many of the Device Fundamentals Tests have a parameter DQ, which stands for Device Query. This is a Simple Data Evaluation Language (SDEL) query. The Windows Driver Test Framework provides SDEL as a query language to simplify the task of collecting targets based on attributes or relationships.
For example, to run the tests for USB devices only, use the device query: class='usb'. You can change the value of each test parameter in the test group.
You can view and edit the all of the runtime test parameters for a test by clicking on the name of the test in the Driver Test Group window. The Driver Test Group window provides a description of the selected test and also provides a description of the test parameters that you select. For information about setting the test parameters, see How to select and configure the Device Fundamentals Tests
After you select the tests, set the parameters, and name the group, click Save.
When you save the test group, the test group will become the currently selected test group, and the name of the test group will appear in the Driver Test toolbar. You can now run tests against the currently selected remote test computer (also shown in the Driver Test toolbar).
Step 5: Build and deploy the driver
- From the Build menu, click Deploy Solution.
For information about deploying a driver automatically at build time, see Deploying a Driver to a Test Computer. For information about automatically setting the Driver Verifier options on the test computer, see Driver Verifier Properties for Driver Projects. You should always enable Driver Verifier on your test computer.
Step 6: Run the tests on the test computer
- From the Driver menu, click Test > Run test. By default, the Run test command runs all of the tests in the currently selected test group.
For information about the driver tests and test categories, see How to select and configure the Device Fundamentals Tests. For information about the testing framework, see Test Authoring and Execution Framework (TAEF) and Windows Driver Test Framework (WDTF).
You can write your own driver tests and deploy those tests on test computers. For more information, see How to write a driver test.
Running the Device Fundamentals tests in Visual Studio early in the development cycle will help you when are finally ready to test your driver using the Windows Hardware Certification Kit (HCK).
- How to run the HCK Test Suites in WDK 8.1
- How to select and configure the Device Fundamentals Tests
- Deploying a Driver to a Test Computer
- Getting Started with Windows Debugging
- Hardware Certification Program
- Windows Hardware Certification Kit (HCK)
- How to test a driver at runtime from a Command Prompt