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

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.
        //*************************************************
        [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) - http://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) - http://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>
    
    
  3. 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++]
      
     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++]
    
      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++]
    
    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++]
    
    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++]
    
     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++]
    
     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++]
    
    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.

Related topics

How to write a driver test using a Driver Test template

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft