Export (0) Print
Expand All

How to write a driver test using a Driver Test template

You can use the Windows Driver Kit (WDK) for Windows 8 to create your own driver tests or to customize some of the tests that are provided. You can deploy the tests that you create to remote test computers using the driver testing framework that the WDK provides for Microsoft Visual Studio Ultimate 2012.

The WDK provides templates that create starter code for a Windows Driver test project in C++, C#, and Script (JScript). You can select the test cases that you want to include, or you can start with a blank project. You can customize the code to add new test cases for your driver. You can deploy your tests from Visual Studio using the driver test framework.

To customize a driver test using the Driver Test template for C++

  1. From the File menu, click New > Project.
  2. From the list of installed templates in the New Project dialog box, select Visual C++ > Windows Driver > Tests.
  3. Select Windows Driver Test in C++.
  4. Provide a name for your driver test project and a location (or use the default).
  5. From the Windows Driver Test dialog box, select the test cases that you want to include or choose an empty (blank) driver test. For more information about the test cases, see Windows Driver test cases.
  6. Add the required test metadata. For more information, see How to add test metadata.
  7. Build your driver test.

To customize a driver test using the Driver Test template for C#

  1. From the File menu, click New > Project.
  2. From the list of installed templates in the New Project dialog box, select Visual C# > Windows Driver .
  3. Select Windows Driver Test in C#.
  4. Provide a name for your driver test project and a location (or use the default).
  5. From the Windows Driver Test dialog box, select the test cases that you want to include or choose an empty (blank) driver test. For information about the test cases, see Windows Driver test cases.
  6. Add the required test metadata. For more information, see How to add test metadata.
  7. Build your driver test.

To customize a driver test using the Driver Test template for Script

  1. From the File menu, click New > Project.
  2. From the list of installed templates in the New Project dialog box, select Script > Windows Driver .
  3. Select Windows Driver Test Script.
  4. Provide a name for your driver test project and a location (or use the default).
  5. From the Windows Driver Test dialog box, select the test cases that you want to include or choose an empty (blank) driver test. For information about the test cases, see Windows Driver test cases.
  6. Add the required test metadata. For more information, see How to add test metadata.
  7. Build your driver test.

Making the driver tests you create available for deployment on test computers

When you build your driver test, the new test will be available for deployment to a test computer. By default, the tests that you create will appear in the test category My Test Category. The names of the tests are based upon the test cases that you choose, and they will have names such as My Plug and Play Surprise Remove Test. During each build of the test, the test will be overwritten. The latest build of the test will be available to deploy and run on the test computer.

Windows Driver test cases

The WDK provides starter code for a Windows Driver test project in C++, C#, and Script. You can select test cases that you want to include, or you can start with a blank project. Not all test cases are available in every language.

Plug and Play Test CasesTest cases that force a driver to handle most of the Plug and Play (PnP)-related IRPs
Disable/EnableProvides code for test cases that disable and enable a PnP device.
RemoveProvides code for test cases that remove a PnP device.
Surprise RemoveProvides code for test cases that perform a surprise remove of a PnP device.
Power Management Test CasesProvides test cases that force a driver to handle system sleep states.
System Sleep StatesProvides code for test cases that perform device I/O while the system cycles through sleep and power state.
Stress and Functionality Test CasesProvides test cases that perform I/O stress and function testing of IOCTL and WMI interfaces.
I/O StressProvides test cases that perform device I/O stress.
Functional IOCTL Interface Provides a template for creating functional test cases for the IOCTL interface. (only available for C++ ).
Functional WMI Interface Provides a template for creating functional test cases for the Windows Management Interface (WMI). (only available in Script)
Empty Test Case
Provides a blank template for creating a Windows Driver test project.

 

Related topics

Test Authoring and Execution Framework
Windows Driver Testing Framework
How to add test metadata

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft