테스트 메타데이터를 추가하는 방법
Windows 8의 경우 WDK(Windows 드라이버 키트)는 테스트 콘텐츠를 만들기 위해 TAEF(테스트 작성 및 실행 프레임워크)를 사용합니다. TAEF 테스트는 각각 특정 테스트 시나리오에 매핑되는 메서드를 여러 개 포함하는 DLL(동적 연결 라이브러리)로 구현되는 개체입니다. TAEF 개체는 관련 메서드를 테스트 그룹으로 결합합니다. 각 테스트에는 테스트를 설명하는 메타데이터 집합이 있습니다. 테스트 이식성 및 캡슐화를 향상하기 위해 TAEF 개체는 테스트 메타데이터를 테스트 자체에 저장합니다. 드라이버 테스트 템플릿을 사용하여 드라이버 테스트를 만들 때 드라이버 테스트를 사용 가능하게 하고 Visual Studio를 통해 배포할 수 있도록 이 메타데이터를 추가해야 합니다.
사전 요구 사항
- 드라이버 테스트의 소스 코드는 다음 드라이버 테스트 템플릿 중 하나를 사용하여 작성됩니다. 자세한 내용은 드라이버 테스트 템플릿을 사용하여 드라이버 테스트를 작성하는 방법을 참조하세요.
테스트 메타데이터 특성을 추가하려면
필요한 테스트 속성 메타데이터를 테스트의 원본 파일에 추가합니다.
예를 들어, 드라이버 테스트 템플릿을 사용하여 안전하지 않은 제거 테스트 버전을 만드는 경우 다음 메타데이터가 추가됩니다. 테스트 설명, 표시 이름, 범주 및 결과 파일 특성을 편집합니다.
// 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()
//************************************************* // 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 스크립트 구성 요소(.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>
다음 표에서는 테스트 속성 특성을 설명합니다. 테스트의 메타데이터를 편집하거나 추가할 때 지침의 예제를 사용하세요.
Description
테스트가 수행하는 작업에 대한 간단한 설명입니다.[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
드라이버 테스트에 표시되는 테스트 이름입니다.[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
메서드 호출에 대한 표준 매개 변수입니다. 테스트는 여러 매개 변수를 사용할 수 있습니다.[Script] <ModuleProperty name="Kits.Parameter" value="TM"/>
[C++] TEST_METHOD_PROPERTY(L"Kits.Parameter", L"DQ")
Kits.Parameter.<ParameterName>.Description
매개 변수에 대한 설명입니다.[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
매개 변수의 기본값입니다.[Script] < TestProperty name="Kits.Parameter.TM.Default" value="Logo"/>
[C++] TEST_METHOD_PROPERTY(L"Kits.Parameter.DQ.Default", L"INF::OriginalInfFileName='%InfFileName%'")
Kits.Drivers
이 특성은 테스트를 WDK 포함 항목으로 표시합니다.[Script] < TestProperty name="Kits.Drivers" value=""/>
[C++] TEST_METHOD_PROPERTY(L"Kits.Drivers", L"TRUE")
Kits.Category
테스트의 범주를 설명합니다.[Script] < TestProperty name="Kits.Category" value="Logo\Device Fundamentals"/>
[C++] TEST_METHOD_PROPERTY(L"Kits.Category", L"My Test Category")
Deploymentitem
파일 및/또는 폴더를 테스트 종속성으로 식별합니다. 여기에는 테스트를 실행하는 데 필요한 모든 리소스가 포함될 수 있습니다. 이 설정에 대한 자세한 내용은 배포 항목 메타데이터를 참조하세요.