How to add test metadata
For Windows 8, the Windows Driver Kit (WDK) uses the Test Authoring and Execution Framework (TAEF) for creating test content. A TAEF test is an object implemented as a dynamic-link library (DLL) that contains multiple methods, where each method maps to a specific test scenario. The TAEF object combines related methods into a group of tests. For each test, there is a set of metadata that describes the test. To improve test portability and encapsulation, TAEF stores test metadata within the test object itself. When you create your own driver tests using the Driver Test templates, you need to add this metadata so that your driver tests are available and can be deployed using Visual Studio.
Prerequisites
- The source code for a driver test written by using one of the Driver Test templates. For information, see How to write a driver test using a Driver Test template.
To add test metadata attributes
Add the required test property metadata to the source files for your test.
For example, if you use the Driver Test template to create your version of the SurpriseRemove test, the following metadata is added. Edit the test description, display name, category, and results file attributes.
C++ // Declare the test class method DoSurpriseRemove - the main test method within this class BEGIN_TEST_METHOD(DoSurpriseRemove) // Required properties for driver tests TEST_METHOD_PROPERTY(L"Kits.Drivers", L"TRUE") TEST_METHOD_PROPERTY(L"Kits.Parameter", L"DQ") TEST_METHOD_PROPERTY(L"Kits.Parameter.DQ.Description", L"A WDTF SDEL query that is used to identify the target device(s) - https://go.microsoft.com/fwlink/p/?linkid=232678") TEST_METHOD_PROPERTY(L"Kits.Parameter.DQ.Default", L"INF::OriginalInfFileName='%InfFileName%'") TEST_METHOD_PROPERTY(L"RebootPossible", L"true") // TODO: Required properties to be customized to match your test requirements TEST_METHOD_PROPERTY(L"Description", L"Plug and Play Surprise Remove Generated Template") TEST_METHOD_PROPERTY(L"Kits.DisplayName", L"My Plug and Play Surprise Remove Test") TEST_METHOD_PROPERTY(L"Kits.Category", L"My Test Category") // Optional properties for driver tests TEST_METHOD_PROPERTY(L"Kits.Drivers.ResultFile", L"TestTextLog.log") // TODO: (see Windows Driver Kit documentation for additional optional properties) END_TEST_METHOD()
C# // // DoSurpriseRemove is a test method as identified by the [TestMethod] tag. // More methods can be added by following this basic pattern. // The name of the function defines the name of the test. // [TestMethod] // Required properties (see Windows Driver Kit documentation for more information): [TestProperty("Kits.Drivers", "TRUE")] [TestProperty("Kits.Parameter", "DQ")] [TestProperty("Kits.Parameter.DQ.Description", "A WDTF SDEL query that is used to identify the target device(s) - https://go.microsoft.com/fwlink/p/?linkid=232678")] [TestProperty("Kits.Parameter.DQ.Default", "INF::OriginalInfFileName='%InfFileName%'")] // TODO: Required properties to be customized to match your test requirements. [TestProperty("Description", "Plug and Play Surprise Remove Generated Template")] [TestProperty("Kits.DisplayName", "My Plug and Play Surprise Remove Test")] [TestProperty("Kits.Category", "My Test Category")] [TestProperty("RebootPossible", "true")] // Optional properties (see Windows Driver Kit documentation for additional optional properties): [TestProperty("Kits.Drivers.ResultFile", "TestTextLog.log")]
Windows Script Component (.wsc)
<!-- Define a test method with metadata: --> <method name="PlugAndPlaySurpriseRemoveTest"> <!-- Required properties for ERT--> <TestMethodProperty name="Kits.Drivers" value="TRUE"/> <TestMethodProperty name="Kits.Parameter" value="DQ"/> <TestMethodProperty name="Kits.Parameter.DQ.Description" value="A WDTF SDEL query that is used to identify the target device(s) - https://go.microsoft.com/fwlink/p/?linkid=232678"/> <TestMethodProperty name="Kits.Parameter.DQ.Default" value="INF::OriginalInfFileName='%InfFileName%'"/> <TestMethodProperty name="RebootPossible" value="true" /> <!-- TODO: Properties to be customized to match your test requirements --> <TestMethodProperty name="Description" value="Plug and Play Surprise Remove Generated Template"/> <TestMethodProperty name="Kits.DisplayName" value="My Plug and Play Surprise Remove Test"/> <TestMethodProperty name="Kits.Category" value="My Test Category"/> <!-- Optional properties for ERT--> <TestMethodProperty name="Kits.Drivers.ResultFile" value="TestTextLog.log"/> <!-- (see Windows Driver Kit documentation for additional optional properties) --> </method>
The following table describes the test property attributes. Use the examples for guidance as you edit or add the metadata for your tests.
Description
A short description of what the test does.[Script] < TestProperty name="Description" value= "This test cycles the system through various sleep states and performs IO on devices before and after each sleep state cycle"/>
C++ [C++]
TEST_METHOD_PROPERTY(L"Description", L"Plug and Play Surprise Remove Generated Template")
DisplayName
The name of the test as it shown in Driver Test.[Script]
< TestProperty name="Kits.DisplayName" value="Sleep with IO Before and After"/>
C++ [C++]
TEST_METHOD_PROPERTY(L"Kits.DisplayName", L"My Plug and Play Surprise Remove Test")
Kits.Parameter
A standard parameter for a method call. A test can have multiple parameters.[Script]
<ModuleProperty name="Kits.Parameter" value="TM"/>
C++ [C++]
TEST_METHOD_PROPERTY(L"Kits.Parameter", L"DQ")
Kits.Parameter.<ParameterName>.Description
The description for the parameter.[Script]
< TestProperty name="Kits.Parameter.TM.Description" value="Test mode parameter: Logo or Simple"/>
C++ [C++]
TEST_METHOD_PROPERTY(L"Kits.Parameter.DQ.Description", L"A WDTF SDEL query that is used to identify the target device(s)")
Kits.Parameter.<ParameterName>.Default
The default value for the parameter.[Script]
< TestProperty name="Kits.Parameter.TM.Default" value="Logo"/>
C++ [C++]
TEST_METHOD_PROPERTY(L"Kits.Parameter.DQ.Default", L"INF::OriginalInfFileName='%InfFileName%'")
Kits.Drivers
This attribute marks the test for inclusion in the WDK.[Script]
< TestProperty name="Kits.Drivers" value=""/>
C++ [C++]
TEST_METHOD_PROPERTY(L"Kits.Drivers", L"TRUE")
Kits.Category
Describes the category of a test.[Script]
< TestProperty name="Kits.Category" value="Logo\Device Fundamentals"/>
C++ [C++]
TEST_METHOD_PROPERTY(L"Kits.Category", L"My Test Category")
Deploymentitem
Identifies files and/or folders as test dependencies. These may contain any resources needed to run the tests. For more information about using this metadata, see DeploymentItem Metadata.