Upload
alyson-degon
View
227
Download
0
Embed Size (px)
Citation preview
Using The Windows Using The Windows Device Testing Device Testing Framework To Simplify Framework To Simplify Windows Driver TestingWindows Driver Testing
Travis Martin, Lead DeveloperTravis Martin, Lead DeveloperAdam Shapiro, Program ManagerAdam Shapiro, Program ManagerWindows Device Experience Windows Device Experience Microsoft CorporationMicrosoft Corporation
Session OutlineSession Outline
Overview and framework goalsOverview and framework goals
Core WDTF conceptsCore WDTF concepts
WDTF-based scenariosWDTF-based scenariosDemoDemo
Extending the frameworkExtending the frameworkDemoDemo
What Is The Windows Device What Is The Windows Device Testing Framework? (WDTF)Testing Framework? (WDTF)
A set of building blocks that enable A set of building blocks that enable developers to build device centric developers to build device centric automated scenariosautomated scenarios
A set of easily customized test scenarios A set of easily customized test scenarios built using the frameworkbuilt using the framework
WDTF ReuseWDTF Reuse
Common Scenario Stress with IO Test (WDK)USB HID Test
DMIInstall/Uninstall/Upgrade/Rollback
Test
Simple IO
Power
Management
Enable
Disable
Install
Uninstall
Transfer
Frameworks Improve QualityFrameworks Improve Quality
Driver Logic
WDF
High Quality Driver
Test Program Logic
WDTF
High Quality Test
WDTF AdvantagesWDTF Advantages
Simplified TestingSimplified Testing
Generic TestingGeneric Testing
Test PnP, Power Management, WMI, and Test PnP, Power Management, WMI, and Security features in your driver/deviceSecurity features in your driver/device
Compatible with the WDK’s Driver Test Compatible with the WDK’s Driver Test Manager (DTM)Manager (DTM)
Creating ScenariosCreating Scenarios
Write scenarios using any language Write scenarios using any language (JScript, VBScript, .NET languages, …)(JScript, VBScript, .NET languages, …)
Scenario writer uses WDTF toScenario writer uses WDTF toFind devicesFind devices
Control devicesControl devices
Control the systemControl the system
Verify functionalityVerify functionality
Log resultsLog results
Optionally wrap the scenario with DTMOptionally wrap the scenario with DTM
ExampleExampleScenarioScenario
// Instantiate WDTF
var WDTF = new ActiveXObject(“WDTF.WDTF”);
// Get collection of all video devices
var Devices = WDTF.DeviceDepot.Query(“class=Net”);
// Loop over each device in the collection
for (int x = 1; x <= Devices.Count; x++)
{
// Find the DeviceManagement action for devices
var DevMan = Devices.Item(x).GetInterface(“Action\\DeviceManagement\\Device”);
DevMan.Disable(); // Disable device
WScript.Sleep(10000); // wait 10 seconds
DevMan.Enable(); // Enable the device
}
Devices As TargetsDevices As Targets
A target object represents a single device A target object represents a single device or systemor system
Collections of TargetsCollections of TargetsA collection of zero or more target instancesA collection of zero or more target instances
Find each target by iterating through Find each target by iterating through a collectiona collection
A scenario can have several A scenario can have several target collectionstarget collections
WDTF ExampleWDTF Example
SimpleIO
Stress
Sleep Stress Script
(PMTE Replacement)
WDTF
Core
Target Device(s) or System
SimpleION
et
Au
dio
Dis
k
Vid
eo
…
Co
nso
le
Dev
Man
…
DTM IntegrationDTM Integration
DTM Jobs WTTLogger
Schedules Uses
Reporting
SimpleIO
Stress
Sleep Stress Script
(PMTE Replacement)
WDTF
Core
Target Device(s) or System
SimpleION
et
Au
dio
Dis
k
Vid
eo
…
Co
nso
le
Dev
Man
…
Instantiating WDTFInstantiating WDTF
The IWDTF interface is the starting pointThe IWDTF interface is the starting point
JScript example: Creating a WDTF objectJScript example: Creating a WDTF objectvar WDTF = new ActiveXObject(“WDTF.WDTF”);var WDTF = new ActiveXObject(“WDTF.WDTF”);
WDTF.SystemDepot propertyWDTF.SystemDepot propertyProvides a target that represents the system as a wholeProvides a target that represents the system as a whole
var System = WDTF.SystemDepot.ThisSystem;var System = WDTF.SystemDepot.ThisSystem;
WDTF.DeviceDepot propertyWDTF.DeviceDepot propertyRepresents a collection of all the devices on the systemRepresents a collection of all the devices on the system
Provides a target that represents the root deviceProvides a target that represents the root devicevar RootDevice = WDTF.DeviceDepot.RootDevice;var RootDevice = WDTF.DeviceDepot.RootDevice;
Query for any subset of those devicesQuery for any subset of those devices
Finding Your TargetFinding Your Target
Select a subset of targets from any collectionSelect a subset of targets from any collection(e.g.,: DeviceDepot)(e.g.,: DeviceDepot)
var Devices = DeviceDepot.Query(“Volume::FreeSize>10000000”);var Devices = DeviceDepot.Query(“Volume::FreeSize>10000000”);
Query criteriaQuery criteriaSystem configuration data – hardware and softwareSystem configuration data – hardware and software
This data is collected by WDTFThis data is collected by WDTF
Data can be technology type specific (disk, volume…)Data can be technology type specific (disk, volume…)
Reference “WDTF Developer’s Guide”Reference “WDTF Developer’s Guide”in WDK documentationin WDK documentation
// Instantiate WDTF
var WDTF = new ActiveXObject(“WDTF.WDTF”);
if (WDTF.DeviceDepot.RootDevice.Eval(“child/service=‘ftdisk’”);
{
WScript.Echo(“The Root device has a direct child who’s ” +
“service name is ‘ftdisk’”);
}
else
{
WScript.Echo(“The Root device does not have any direct child with a ” +
“service name of ‘ftdisk’”);
}
Target::Eval(…)Target::Eval(…)Classifying a TargetClassifying a Target
Target::GetValue(…)Target::GetValue(…)Retrieving Information from TargetsRetrieving Information from Targets
// Instantiate WDTF
var WDTF = new ActiveXObject(“WDTF.WDTF”);
var ProcArch = WDTF.SystemDepot.ThisSystem.GetValue(“ProcArch”);
WScript.Echo(“We are executing on an ” + ProcArch + “ build of Windows.”);
Target::GetRelations(…)Target::GetRelations(…)Finding Related TargetsFinding Related Targets
// Instantiate WDTF
var WDTF = new ActiveXObject(“WDTF.WDTF”);
// Start with the root device
PrintAll_recursive(WDTF.DeviceDepot.RootDevice);
function PrintAll_recursive(Device)
{
WScript.Echo(“Name: ” + Device.GetValue(“#FriendlyName”);
WScript.Echo(“Class: ” + Device.GetValue(“Class”);
WScript.Echo(“DeviceID: ” + Device.GetValue(“DeviceID”);
WScript.Echo(“”);
var Devices = Device.GetRelations(“child”);
// Recurse down for each device in the collection
for (int x = 1; x <= Devices.Count; x++)
{
PrintAll_recursive(Devices.Item(x));
}
}
Action Interfaces Action Interfaces
Simple control interfaces for a targetSimple control interfaces for a target
SynchronousSynchronousDevMan = Device.GetInterface(“Action\\DeviceManagement\\Device”);DevMan = Device.GetInterface(“Action\\DeviceManagement\\Device”);
Console = WDTF.SystemDepot.ThisSystem.GetInterface(“Action\\Console”);Console = WDTF.SystemDepot.ThisSystem.GetInterface(“Action\\Console”);
Action\SimpleIOAction\SimpleIOSmall, re-usable components that test one particular area of Small, re-usable components that test one particular area of functionality for a targetfunctionality for a target
Open, exercise, and close a deviceOpen, exercise, and close a device
Framework provides a set of device specific SimpleIO Framework provides a set of device specific SimpleIO (Audio, Network, Volumes, Optical Media, and Video)(Audio, Network, Volumes, Optical Media, and Video)
Framework finds and loads the correct implementation Framework finds and loads the correct implementation for a targetfor a target
Manageable Tests (MTest)Manageable Tests (MTest)
Asynchronous Action WrapperAsynchronous Action WrapperStart, Pause, Stop, Resume, etc.Start, Pause, Stop, Resume, etc.
Framework finds and loads the correct Framework finds and loads the correct implementation for a targetimplementation for a target
var MTest = Device.GetInterface(“MTest\\SimpleIO”);var MTest = Device.GetInterface(“MTest\\SimpleIO”);
ExampleExampleScenarioScenario
// Instantiate WDTF
var WDTF = new ActiveXObject(“WDTF.WDTF”);
// Get collection of all video devices
var Devices = WDTF.DeviceDepot.Query(“class=Net”);
// Loop over each device in the collection
for (int x = 1; x <= Devices.Count; x++)
{
// Find the DeviceManagement action for devices
var DevMan = Devices.Item(x).GetInterface(“Action\\DeviceManagement\\Device”);
DevMan.Disable(); // Disable device
WScript.Sleep(10000); // wait 10 seconds
DevMan.Enable(); // Enable the device
}
WDTF Actions And MTestsWDTF Actions And MTests
ReleasedReleasedAction\ConsoleAction\Console
Power management, reboot, shutdown, logoff, etcPower management, reboot, shutdown, logoff, etc
Action\DeviceManagementAction\DeviceManagementDisable/Enable, Install/Uninstall, resources, driver packagesDisable/Enable, Install/Uninstall, resources, driver packages
Action\SimpleIOAction\SimpleIOSimple synchronous I/O verification for a targetSimple synchronous I/O verification for a target
MTest\SimpleIOMTest\SimpleIOImplemented by WDTF as an asynchronous layer Implemented by WDTF as an asynchronous layer over Action\SimpleIOover Action\SimpleIO
Planned for V2Planned for V2WMIWMI
IOCTLIOCTL
Running A Running A WDTF-Based ScenarioWDTF-Based Scenario
Travis MartinTravis MartinSDESDEWindows Device Experience GroupWindows Device Experience Group
Extending WDTFExtending WDTF
Modify existing scenarios Modify existing scenarios
Create new implementations of Actions for Create new implementations of Actions for new device types new device types
We provide guidelines, interfaces, base We provide guidelines, interfaces, base classes, and a Visual Studio wizard in classes, and a Visual Studio wizard in the WDKthe WDK
Create new Action or MTest interfaces to Create new Action or MTest interfaces to expose additional device functionalityexpose additional device functionality
Implement A New Implement A New SimpleIO ActionSimpleIO Action
Travis MartinTravis MartinSDESDEWindows Device Experience GroupWindows Device Experience Group
Call To ActionCall To Action
Attend the WDTF “Hands-On” LabAttend the WDTF “Hands-On” Lab
Run the WDTF-based scenarios in the Run the WDTF-based scenarios in the WDK kitsWDK kits
Create new WDTF-based scenariosCreate new WDTF-based scenarios
Create SimpleIO Actions for your devicesCreate SimpleIO Actions for your devices
Optionally, create new Actions Optionally, create new Actions and MTestsand MTests
Use your new Actions and MTests in Use your new Actions and MTests in your scenariosyour scenarios
Additional ResourcesAdditional Resources
DocumentationDocumentation““Other Tools” section of the WDK DocsOther Tools” section of the WDK Docs
Related SessionsRelated SessionsDEV010DEV010 Best Practices for Testing Best Practices for Testing Windows DriversWindows Drivers
DEV098DEV098 Using the Device Using the Device Simulation FrameworkSimulation Framework
E-mail questions toE-mail questions to WDTFSupp @ microsoft.comWDTFSupp @ microsoft.com
© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions,
it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.