Introduce the background and initial implementation of WinAppDriver - WebDriver for Windows Applications, including desktop applications, store apps (formerly known as Metro-style apps).
4. UIA Overview
✤ Provider and Clients!
✤ Provider API - to create support for custom controls.!
✤ Client API - to create assistive technologies or implement
automated testing.!
✤ Support various UI frameworks, including Win32, WinForms,
WPF, HTML, Silverlight.!
✤ Provide a unified object model that masks any differences in the
UI frameworks.
5. TestingTools inWindows SDK
✤ Inspect (formerly known as UI Spy) - for inspecting
element's accessibility data, including UIA properties
and MSAA properties.!
✤ AccScope - for evaluating accessibility in the early
phase of development, and finding out areas needed
to be improved.!
✤ Both are good examples of UIA clients.
6. Key UIA Properties
✤ Automation ID - not localized, preferred.!
✤ Control Type!
✤ Name - may be localized.!
✤ Set a Unique Automation Property for Windows Store
Controls for Testing
7. 01
UIA
Security Model
✤ Be signed and trusted!
✤ uiAccess=“true” (manifest)!
✤ Be installed in a secure location
PikeMarket
Seattle,WA
8. Security Considerations
To use UIAccess, an assistive technology application needs to:!
✤ Be signed with a certificate to interact with applications running at a
higher privilege level.!
✤ Be trusted by the system and run with administrative privileges. The
application must be installed in a secure location that requires a user
account control (UAC) prompt to write to (for example, the Program
Files folder).!
✤ Be built with a manifest file that includes the UIAccess flag.
Source: Security Considerations for Assistive Technologies (Windows)
9. Be Signed andTrusted
To interact with applications running at a higher
privilege level.
Process Explorer
10. uiAccess=“true” (manifest)
To gain access to the protected system UI.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<!-- omitted -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="true"></
requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
The manifest of Inspect.exe:
11. Test Code in C#
var accField = app.FindFirst(TreeScope.Descendants,
new PropertyCondition(AutomationElement.AutomationIdProperty, "txt_UserId"));
((ValuePattern)accField.GetCurrentPattern(ValuePattern.Pattern)).setValue("account");
!
var pwdField = app.FindFirst(TreeScope.Descendants,
new PropertyCondition(AutomationElement.AutomationIdProperty, "txt_UserPwd"));
((ValuePattern)pwdField.GetCurrentPattern(ValuePattern.Pattern)).setValue("secret");
!
var loginBtn = app.FindFirst(TreeScope.Descendants,
new PropertyCondition(AutomationElement.AutomationIdProperty, "btn_Login"));
((InvokePattern)loginBtn.GetCurrentPattern(InvokePattern.Pattern)).Invoke();
Test Code in Python
12. 01
Survey
✤ Code UI Test (VS Premium/Ultimate)!
✤ IronPython!
✤ Python for .NET!
✤ WinAppDriver
GumWall
PikeMarket,Seattle,WA
13. Requirements
✤ Scriptable in Python ➠ Robot Framework and PyUIA
integration!
✤ Support Windows Vista (.NET Framework 3.0
included) and above.!
✤ As a testing tool, it is important to have fewer
dependencies.!
✤ Remote control (RC)
15. Python for .NET != IronPython
If you want to mainly base your code on the .NET
framework, I'd highly recommend IronPython vs
Python.NET. IronPython is pretty much native .NET - so it
just works great when integrating with other .NET languages.!
Python.NET is good if you want to just integrate one or two
components from .NET into a standard python application.
Source: IronPython vs. Python .NET - Stack Overflow
16. IronPython
✤ It works, but is slow and buggy?!
✤ Not 100% compatible with CPython, subtle differences
may lead to big issues in the future.!
✤ No longer supported by Microsoft.
17. Python for .NET
✤ It works and performs very well.!
✤ We have to modify Python executable’s manifest and
resign it. (tricky)!
✤ BTW, the Python code manipulating UIA API looks
weird.
18. 01
WinAppDriver
✤ Incubated by KKBOX SQA
team.!
✤ imsardine/winappdriver
(GitHub)!
✤ MIT License
First StarbucksStore
PikeMarket,Seattle,WA
24. WinAppDriver forWindows XYZ
WinAppDriver
UIA Client API
Win
Phone?
Store
Apps
Desktop!
Apps
✤ Written in C#.!
✤ Implement JSON/
WebDriver Wire Protocol.!
✤ Support desktop
applications and store
apps.!
✤ WP support is planned.
25. Test Code in Python
from selenium.webdriver import Remote, DesiredCapabilities
desired_caps = {
'app': 'http://.../AppPackages_0098.zip',
'appUserModelId': '2DE213C9.KKBOX_wttxem0f9q9s0!App',
'appWindowName': 'KKBOX',
'newCommandTimeout': 10 * 60,
}
driver = Remote('http://172.16.41.128:4444/wd/hub', desired_caps)
driver.find_element_by_id(‘txt_UserId’).set_value('account')
driver.find_element_by_id(‘txt_UserPwd’).set_value('secret')
driver.find_element_by_id(‘btn_Login’).click()
Test Code in C#
26. Benefits
✤ REPL (Read–Eval–Print Loop)!
✤ Freedom of choice!
✤ Programming languages!
✤ Testing frameworks!
✤ Operating systems on which test code will run.!
✤ Support Windows Vista and above.!
✤ Remote control - SUT and test code are not necessary to be run on the
same machine. (deployment flexibility)
27. Similar Projects
✤ jasongdove/win-driver (prototyping? 08/05/2013)!
✤ Based on TestStask.White and ServiceStack (commercial licensing).!
✤ Does’t support store apps and touch gestures yet.!
✤ Twin (eBay, 08/21/2011)!
✤ Use UIA client API immediately.!
✤ Doesn’t support store apps and touch gestures yet.!
✤ Does not follow the standard, that’s why a dedicated Java client
library is needed.
28. TODO
✤ Download, install and uninstall app packages automatically.!
✤ PyUIA Integration!
✤ Implement remaining commands defined in the protocol. (logs,
screenshots, …)!
✤ Fast reset - clear data without uninstalling the package!
✤ WP support.!
✤ MacDriver for OS X test automation? (appium/appium-for-mac)
29. References
✤ UI Automation Overview, Using UI Automation for
Automated Testing, Testing Tools - Windows Automation API!
✤ Automating the testing of Windows 8 apps - Windows 8 app
developer blog - Site Home - MSDN Blogs (09-05-2012)!
✤ UI Automation Security Overview, Security Considerations
for Assistive Technologies (Windows)!
✤ Windows Store Applications and Automated Testing – Part
One, Two, Three (06/12/2013)