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.


To add test metadata attributes

  1. Add the required test property metadata to the source files for your test.
  2. 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.
        // 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.
        // 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) -")]
        [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) -"/>
        <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) -->
  3. The following table describes the test property attributes. Use the examples for guidance as you edit or add the metadata for your tests.


    A short description of what the test does.

      < 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"/>
     TEST_METHOD_PROPERTY(L"Description", L"Plug and Play Surprise Remove Generated Template")

    The name of the test as it shown in Driver Test.

     < TestProperty name="Kits.DisplayName" value="Sleep with IO Before and After"/>
      TEST_METHOD_PROPERTY(L"Kits.DisplayName", L"My Plug and Play Surprise Remove Test") 

    A standard parameter for a method call. A test can have multiple parameters.

    <ModuleProperty name="Kits.Parameter" value="TM"/>
    TEST_METHOD_PROPERTY(L"Kits.Parameter", L"DQ")

    The description for the parameter.

    < TestProperty name="Kits.Parameter.TM.Description" value="Test mode parameter: Logo or Simple"/> 
    TEST_METHOD_PROPERTY(L"Kits.Parameter.DQ.Description", L"A WDTF SDEL query that is used to identify the target device(s)")

    The default value for the parameter.

    < TestProperty name="Kits.Parameter.TM.Default" value="Logo"/>
     TEST_METHOD_PROPERTY(L"Kits.Parameter.DQ.Default", L"INF::OriginalInfFileName='%InfFileName%'")  

    This attribute marks the test for inclusion in the WDK.

    < TestProperty name="Kits.Drivers" value=""/>

    Describes the category of a test.

    < TestProperty name="Kits.Category" value="Logo\Device Fundamentals"/>
    TEST_METHOD_PROPERTY(L"Kits.Category", L"My Test Category")

    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.

Related topics

How to write a driver test using a Driver Test template



Send comments about this topic to Microsoft

© 2014 Microsoft