WindowsAutomation Reference 1.0

Aus expecco Wiki (Version 2.x)
Wechseln zu: Navigation, Suche

This is the WindowsAutomation-Plugin documentation.

This expecco plugin provides facilities to automate tests incorporating applications with a GUI based on Windows Presentation Foundation (WPF). It also lets you access GUI components, to use and validate them in a test. f

Features

  • Automated GUI testing of WPF applications
  • Parallel remote test-execution on multiple systems
  • Performs tests against completely built and executable WPF applications. No source code changes / recompilation of the application is required
  • Access GUI components, using XPath-like locators.
  • Access objects of the application live at execution time.
  • Consists of an expecco block library and tools which help to model tests and inspect the GUI of the application

Installation and Connection

The WindowsAutomation testing plugin uses a so called ".NET-Bridge" which consists of two parts: one side is a plugin for expecco, the other side is an .NET console application (the "WindowsAutomationApplication").

Requirements

On the test executing machine.

  • .NET Framework 3.5 [1] or higher.
  • One of the following operation systems:
- Windows XP (with the Windows Automation API library [2])
- Windows Vista (with the Windows Automation API library [3])
- Windows 7
- Windows 8
- Windows 8.1
- Windows Server 2003 (with the Windows Automation API library [4])
- Windows Server 2008(with the Windows Automation API library [5])
- Windows Server 2008 R2
- Windows Server 2012
- Windows Server 2012 R2

Plugin Components

The plugin consists of the following parts:

  • The GUI Browser, used to explore your application.
  • The WindowsAutomation Library, provides blocks that you can use in your test-cases.
  • The WindowsAutomationApplication, provides the interface between the tested application and your tests (i.e. expecco).

Installing and Configuring the Plugin in Expecco

The plugin is usually installed automatically by the installer; either included in the main expecco installation or provided as a separate installable add-on package. Its files are stored in the "plugin" subfolder of the expecco installation folder. You can also copy those files manually to that folder, if required. Expecco detects the plugin automatically during startup. So it may be required to restart any expecco session.

If you want expecco to automatically connect to the local computer by opening up a connection navigate to "Extras->Settings->Plugins->WindowsAutomation". Make sure the Path of the WindowsAutomationApplication is entered correctly and the checkbox is selected.
To set up a manual connection unselect the checkbox, open up the connection in expecco and subsequently start the WindowsAutomationApplication.

Installing and Running the WindowsAutomationApplication

The WindowsAutomationApplication is a .NET console application. It uses the so called ".Net-Bridge" to connect to expecco. You just need to copy the folder containing the "WindowsAutomationApplication.exe" to the computer you want to run the tests on. The WindowsAutomationApplication does not need any further installation.

To run the client manually and connect to expecco on the default port, port 9988, without any extensions just double click onto the "WindowsAutomationApplication.exe".

Arguments

The GuiBrowser with and without the DevExpress extension.
Arguments Description
-port <int> The TCP-Port to run the connection on.
-mode <server/client> To start the .Net-Bridge as TCP-Server or to run as TCP-Client.
-keepAlive <true/false> To keep the .Net-Bridge alive for reconnect. (If started as Server only!)
-log <path> Path to write a logfile.

Additional Arguments for the WindowsAutomationApplication.DevExpress

The WindowsAutomationApplication.DevExpress is an enhanced client application for the PlugIn. It can be used to browse through applications build with DevExpress. To take benefit out of the extension you have to extend the applications you want to browse through.

Arguments Description
-extend <path> Path of an application within the .Net-VM to be shown with the DevExpress extension.
-extendDynamically <true/false> To work with dynamic gui applications or save some performance.
-recordMap <path> Path to wite a xMap for an extended application.
-map <path> Path of an xMap to extend the Browser with.


If you want to run the WindowsAutomationApplication on another TCP port you have to start the client using the command prompt, specifying the port number using the -port parameter.

  C:\Programme\exept\expecco\plugin\windowsAutomation\systemDLL\WindowsAutomationIDEClient>WindowsAutomationApplication.exe -port 9987

Settings

Windows Automation settings dialog.

Open "Extras->Settings->Plugins->WindowsAutomation" to inspect or change the plugin settings. The settings are composed in four categories: connection settings, execution settings, recording settings and advanced settings.

For further information on connection settings please refer to the chapter "Installation and Connection".


The execution settings affect the way blocks are executed. You are able to decide how they respond to a failure while execution. Potentially an element they are trying to address isn't properly constructed yet. If the check box "Retry Execution" is checked the delay time adjusted in the text box "Execution Timeout" will be applied and the execution will be repeated till an error appears.


In the recording settings you can select which devices you want to record. You have the choice between mouse, keyboard or both of them. The recording mode can be switched. Recording input devices is default and recommended. However you can use recording keycodes to record key combinations and hotkeys. Due to performance and stability issues the use of recording keycodes isn't recommended if another recording mode can be used.

Another option is to record event based changes. Recording events is a higher level way of recording. Since handles have to been added to the windows only windows opened after recording was initialized are recorded properly. Events are a clean and simple way of recording if the application you want to record interaction with does support them.

Recording all events is not recommended since one user interaction might trigger few events.


The check box "Filter Windows GUI Elements" allows you to activate or deactivate a filter in the GUI Browser. If it is activated you just see windows belonging to applications. The menu bar, file system windows and temporarily shown windows for example tool tip windows aren't displayed. If you activate "Show Warnings" unexpected events occurring during the connection will raise a warning message.

The check box "Update Top Elements" allows you to decide if new applications appear in the tree of the GUI Browser by themselves. Please be aware that the plugin might run smoother if this check box is unselected.

GUI Browser

The GUI browser allows you to explore a running WPF application. You can browse the application, inspect element properties and execute actions. For a more detailed description on how to use and what to do with the GUI browser also see Expecco GUI Tests Extension Reference.

WindowsAutomation Library

The Windows Automation library.

For automation and testing of an application, a library of building blocks is provided, which contains functional blocks for all of those operations.

The WindowsAutomation Library consists of a set of predefined function blocks which are used to model your tests. Import this library via expecco's "Import Library" menu-function.


Connections

Settings
Settings valid for the current connection. You usually do not need to make a change on these.
Set Execution Timeout
Set the timeout for each execution.
timeout <Integer> - Timeout in milliseconds.
Set Execution Delay
Set the delay between each try for each execution.
delay <Integer> - Delay in milliseconds.


Setup Connection
Establish a connection to a target host by its network address.
Optional: ip <String> - The IP-network address or host name of the host you want to connect to. Default is localhost.
Optional: port <Integer> - The TCP port to use for the connection. The default port is 9988.
Optional: name <String> - A identifier for the connection. Default is local.
Close Connection
Close down all connections.

Elements

Element actions, sorted by the type of components and pattern.

By Components

By Components.

Element actions sorted by the type of components.

Click
Click onto an element.
path <String> - Identifier for the element a command should be executed for.
Double Click
Double-Click onto an element.
path <String> - Identifier for the element a command should be executed for.
Right Click
Right-Click onto an element.
path <String> - Identifier for the element a command should be executed for.
Set Focus
Set the focus onto an element.
path <String> - Identifier for the element a command should be executed for.
Get Property Value
Get any property value.
path <String> - Identifier for the element a command should be executed for.
property <String> - The identifier for a property, for example to get the property value.
Return: value <String> - The current property value.
Get Property Value As Boolean
Get any property value as boolean.
path <String> - Identifier for the element a command should be executed for.
property <String> - The identifier for a property, for example to get the property value.
Return: isBoolean <Boolean> - Identifies whether the property has a boolean value or not.
Return: value <Boolean> - The current property value.
Is Boolean Property
Check if a property value is boolean.
path <String> - Identifier for the element a command should be executed for.
property <String> - The identifier for a property, for example to get the property value.
Return: isBoolean <Boolean> - Identifies whether the property has a boolean value or not.
Get Name
Get the name.
path <String> - Identifier for the element a command should be executed for.
Return: name <String> - The elements current name.
Get Class Name
Get the classname.
path <String> - Identifier for the element a command should be executed for.
Return: className <String> - The elements current classname.
Get Position
Get the position.
path <String> - Identifier for the element a command should be executed for.
Return: position <String> - The elements current position.
Is Enabled
Check if the element is enabled.
path <String> - Identifier for the element a command should be executed for.
Return: isEnabled <Boolean> - Identifies if the element is enabled or not.
Is Focusable
Check if the element in focusable.
path <String> - Identifier for the element a command should be executed for.
Return: isFocusable <Boolean> - Identifies if the element is focusable or not.


Button
Perform Click
Simulate the click onto a button.
path <String> - Identifier for the element a command should be executed for.


RadioButton
Select
Select an Item.
path <String> - Identifier for the element a command should be executed for.
Unselect
Unselect an Item.
path <String> - Identifier for the element a command should be executed for.
Toggle
Toogle between states.
path <String> - Identifier for the element a command should be executed for.
Is Selected
Check if the RadioButton is selected.
path <String> - Identifier for the element a command should be executed for.
Return: isSelected <Boolean> - Identifies if the element is currently selected.


CheckBox
Check
Check the CheckBox.
path <String> - Identifier for the element a command should be executed for.
Uncheck
Uncheck the CheckBox.
path <String> - Identifier for the element a command should be executed for.
Toggle
Toogle the state.
path <String> - Identifier for the element a command should be executed for.
Is Checked
Check if the CheckBox is checked.
path <String> - Identifier for the element a command should be executed for.
Return: isChecked <Boolean> - Identifies if the element is currently checked.


List
Has Enabled List Item
Check if List has specified Child List Item and if Child List Item is enabled.
path <String> - Identifier for the element a command should be executed for.
entryName <String> - Identifier for the child element.
Return: hasEnabledEntry <Boolean> - Identifies if the specified element is a child list item.
Return: path <String> - Identifies for the element.
Has List Item
Check if List has specified Child List Item.
path <String> - Identifier for the element a command should be executed for.
entryName <String> - Identifier for the child element.
Return: hasEntry <Boolean> - Identifies if the specified element is a child list item.
Return: path <String> - Identifies for the element.


Menu
Get Menu Entry Property Value
Get any property value for Child Menu Entry.
path <String> - Identifier for the element a command should be executed for.
entryName <String> - Identifier for the child element.
property <String> - The identifier for a property, for example to get the property value.
Return: value <String> - The current property value.
Has Enabled Menu Entry
Check if Menu has specified Child Menu Item and if Child Menu Item is enabled.
path <String> - Identifier for the element a command should be executed for.
entryName <String> - Identifier for the child element.
Return: hasEnabledEntry <Boolean> - Identifies if the specified element is a child menu item.
Return: path <String> - Identifies for the element.
Has Menu Entry
Check if Menu has specified Child Menu Item.
path <String> - Identifier for the element a command should be executed for.
entryName <String> - Identifier for the child element.
Return: hasEntry <Boolean> - Identifies if the specified element is a child menu item.
Return: path <String> - Identifies for the element.
Select Menu Entry
Select an Child Menu Item.
path <String> - Identifier for the element a command should be executed for.
entry name <String> - Identifier for the child element.
Return: entryPath <String> - Identifier of selected Menu. Can be used to cascade menus.
Open Menu
Perform the Action of an Menu Item.
path <String> - Identifier for the element a command should be executed for.


ScrollBar
Scroll
Scroll for a large decrement.
path <String> - Identifier for the element a command should be executed for.
Scroll Small Decrement
Scroll for a small decrement.
path <String> - Identifier for the element a command should be executed for.
Is Horizontal Oriented
Check the scrollbars orientation.
path <String> - Identifier for the element a command should be executed for.
Return: isHorizontal <Boolean> - Identifies if the element is aligned in a horizontal direction.
Is Vertical Oriented
Check the scrollbars orientation.
path <String> - Identifier for the element a command should be executed for.
Return: isVertical <Boolean> - Identifies if the element is aligned in a vertical direction.


Tab
Has Enabled Tab Item
Check if Tab has specified Child Tab Item and if Child Tab Item is enabled.
path <String> - Identifier for the element a command should be executed for.
entryName <String> - Identifier for the child element.
Return: hasEnabledEntry <Boolean> - Identifies if the specified element is a child tab item.
Return: path <String> - Identifies for the element.
Has Tab Item
Check if Tab has specified Child Tab Item.
path <String> - Identifier for the element a command should be executed for.
entryName <String> - Identifier for the child element.
Return: hasEntry <Boolean> - Identifies if the specified element is a child tab item.
Return: path <String> - Identifies for the element.


Text
Set Text
Change the text.
path <String> - Identifier for the element a command should be executed for.
text <String> - Text to change to.
Is Read Only
Check if the field is read only.
path <String> - Identifier for the element a command should be executed for.
Return: isReadOnly <Boolean> - Identifies if the element is read only or not.
Has Keyboard Focus
Check if the element does have the focus.
path <String> - Identifier for the element a command should be executed for.
Return: hasFocus <Boolean> - Identifies if the element is currently focused.


Tree
Has Enabled Tree Item
Check if Treehas specified Child Tree Item and if Child Tree Item is enabled.
path <String> - Identifier for the element a command should be executed for.
entryName <String> - Identifier for the child element.
Return: hasEnabledEntry <Boolean> - Identifies if the specified element is a child tree item.
Return: path <String> - Identifies for the element.
Has Tree Item
Check if Tab has specified Child Tree Item.
path <String> - Identifier for the element a command should be executed for.
entryName <String> - Identifier for the child element.
Return: hasEntry <Boolean> - Identifies if the specified element is a child tree item.
Return: path <String> - Identifies for the element.


Window
Maximize
Maximize an window.
path <String> - Identifier for the element a command should be executed for.
Minimize
Minimize an window.
path <String> - Identifier for the element a command should be executed for.
Normalize
Normalize an window.
path <String> - Identifier for the element a command should be executed for.
Close
Close an window.
path <String> - Identifier for the element a command should be executed for.
Rotate
Rotate an window.
path <String> - Identifier for the element a command should be executed for.
value <String> - The degree you want to rotate the window.
Resize
Resize an window.
path <String> - Identifier for the element a command should be executed for.
valueForX <String> - New size for dimension x.
valueForY <String> - New size for dimension y.
Move
Move an window.
path <String> - Identifier for the element a command should be executed for.
valueForX <String> - X-coordinate you want to move the upper left corner of the window to.
valueForY <String> - Y-coordinate you want to move the upper left corner of the window to.
Get Interaction State
Get the interaction state.
path <String> - Identifier for the element a command should be executed for.
Return: state <String> - The window interaction state.
Get Visual State
Get the visual state.
path <String> - Identifier for the element a command should be executed for.
Return: state <String> - The current visual state.
Is Maximized
Check if the window is maximized.
path <String> - Identifier for the element a command should be executed for.
Return: isMaximized <Boolean> - Identifies if the element is maximized.
Is Minimized
Check if the window is minimized.
path <String> - Identifier for the element a command should be executed for.
Return: isMinimized <Boolean> - Identifies if the element is minimized.
Is Topmost
Check if the window is topmost.
path <String> - Identifier for the element a command should be executed for.
Return: isTopmost <Boolean> - Identifies if the element is topmost.


Is Offscreen
Check if the window is offscreen.
path <String> - Identifier for the element a command should be executed for.
Return: isOffscreen <Boolean> - Identifies if the element is aligned in offscreen.
Can Maximize
Check if the window can maximize.
path <String> - Identifier for the element a command should be executed for.
Return: canMaximize <Boolean> - Identifies if the window can be maximized.
Can Minimize
Check if the window can minimize.
path <String> - Identifier for the element a command should be executed for.
Return: canMinimize <Boolean> - Identifies if the window can be minimized.
Can Move
Check if the window can move.
path <String> - Identifier for the element a command should be executed for.
Return: canMove <Boolean> - Identifies if the window can be moved.
Can Rotate
Check if the window can rotate.
path <String> - Identifier for the element a command should be executed for.
Return: canRotate <Boolean> - Identifies if the window can be rotated.
Can Resize
Check if the window can resize.
path <String> - Identifier for the element a command should be executed for.
Return: canResize <Boolean> - Identifies if the window can be resized.


By Pattern

By Pattern.

Element actions sorted by there pattern. If you want to learn more about UI Automation Control Pattern you can find the documentation at the MSDN [6].

Invoke Pattern
Invoke
Invoke an Element, for Example an Button and perform its distinct Action.
path <String> - Identifier for the element a command should be executed for.


Menu Pattern
Click Menu
Perform the Action of an Menu Item.
path <String> - Identifier for the element a command should be executed for.


Scroll Item Pattern
Scroll
Scroll for a large decrement.
path <String> - Identifier for the element a command should be executed for.
Scroll Small Decrement
Scroll for a small decrement.
path <String> - Identifier for the element a command should be executed for.


Selection Item Pattern
AddSelection
Select an Item.
path <String> - Identifier for the element a command should be executed for.
RemoveSelection
Unselect an Item.
path <String> - Identifier for the element a command should be executed for.


Toogle Pattern
Toggle
Toogle an Element, for Example an Button and Switch its Status.
path <String> - Identifier for the element a command should be executed for.


Transform Pattern
Rotate
Rotate an window.
path <String> - Identifier for the element a command should be executed for.
value <String> - The degree you want to rotate the window.
Resize
Resize an window.
path <String> - Identifier for the element a command should be executed for.
valueForX <String> - New size for dimension x.
valueForY <String> - New size for dimension y.
Move
Move an window.
path <String> - Identifier for the element a command should be executed for.
valueForX <String> - X-coordinate you want to move the upper left corner of the window to.
valueForY <String> - Y-coordinate you want to move the upper left corner of the window to.


Window Pattern
Maximize Window
Maximize an window.
path <String> - Identifier for the element a command should be executed for.
Minimize Window
Minimize an window.
path <String> - Identifier for the element a command should be executed for.
Normalize Window
Normalize an window.
path <String> - Identifier for the element a command should be executed for.
Close Window
Close an window.
path <String> - Identifier for the element a command should be executed for.


Value Pattern
Set Value
Change the value, for example the text, of an element.
path <String> - Identifier for the element a command should be executed for.
value <String> - Value to change to.


Implementation

Blocks implementing core functionality are stored in here. They should not be needed for building up tests.

Input Devices

Input Devices.

Mouse and Keyboard operations are implemented in here.

Mouse

Click
Click onto an element.
path <String> - Identifier for the element a command should be executed for.
Double Click
Double-Click onto an element.
path <String> - Identifier for the element a command should be executed for.
Right Click
Right-Click onto an element.
path <String> - Identifier for the element a command should be executed for.

Keyboard

Backspace
Simulating stroke onto backspace.
path <String> - Identifier for the element a command should be executed for.
Caps Lock
Simulating stroke onto caps lock.
path <String> - Identifier for the element a command should be executed for.
Enter
Simulating stroke onto enter.
path <String> - Identifier for the element a command should be executed for.
Esc
Simulating stroke onto escape.
path <String> - Identifier for the element a command should be executed for.
Space Bar
Simulating stroke onto the space bar.
path <String> - Identifier for the element a command should be executed for.
Tab
Simulating stroke onto tab.
path <String> - Identifier for the element a command should be executed for.


Any Key
Send Key
Simulating stroke onto any key.
path <String> - Identifier for the element a command should be executed for.
key <String> - Key or text you want to simulate key strokes for.
Send Key + CTRL
Simulating stroke onto a function key while ctrl is pressed.
path <String> - Identifier for the element a command should be executed for.
key <String> - Key or text you want to simulate key strokes for.
Send Key + ALT
Simulating stroke onto a function key while alt is pressed.
path <String> - Identifier for the element a command should be executed for.
key <String> - Key or text you want to simulate key strokes for.
Send Key + SHIFT
Simulating stroke onto a function key while shift is pressed.
path <String> - Identifier for the element a command should be executed for.
key <String> - Key or text you want to simulate key strokes for.
Send Key + CTRL + ALT
Simulating stroke onto a function key while ctrl and alt are pressed.
path <String> - Identifier for the element a command should be executed for.
key <String> - Key or text you want to simulate key strokes for.
Send Random Phrase
Simulate the key stroes for the input of a random phrase.
path <String> - Identifier for the element a command should be executed for.


Arrow Key
Up
Simulating stroke onto up.
path <String> - Identifier for the element a command should be executed for.
Down
Simulating stroke onto down.
path <String> - Identifier for the element a command should be executed for.
Right
Simulating stroke onto right.
path <String> - Identifier for the element a command should be executed for.
Left
Simulating stroke onto left.
path <String> - Identifier for the element a command should be executed for.


Function Key
F1 ... F12
Simulating stroke onto a function key.
path <String> - Identifier for the element a command should be executed for.


Numpad
Num Lock
Simulating stroke onto numlock.
path <String> - Identifier for the element a command should be executed for.
+
Simulating stroke onto plus.
path <String> - Identifier for the element a command should be executed for.
-
Simulating stroke onto minus.
path <String> - Identifier for the element a command should be executed for.
*
Simulating stroke onto times.
path <String> - Identifier for the element a command should be executed for.
/
Simulating stroke onto divide.
path <String> - Identifier for the element a command should be executed for.
End
Simulating stroke onto end.
path <String> - Identifier for the element a command should be executed for.
Page Down
Simulating stroke onto page down.
path <String> - Identifier for the element a command should be executed for.
Page UP
Simulating stroke onto page up.
path <String> - Identifier for the element a command should be executed for.
Home
Simulating stroke onto pos1.
path <String> - Identifier for the element a command should be executed for.
Insert
Simulating stroke onto insert.
path <String> - Identifier for the element a command should be executed for.
Delete
Simulating stroke onto delete.
path <String> - Identifier for the element a command should be executed for.

Properties

Properties.

Blocks to access property values.

Get Property Value
Get any property value.
path <String> - Identifier for the element a command should be executed for.
property <String> - The identifier for a property, for example to get the property value.
Return: value <String> - The current property value.
Get Name
Get the name.
path <String> - Identifier for the element a command should be executed for.
Return: name <String> - The elements current name.
Get Class Name
Get the classname.
path <String> - Identifier for the element a command should be executed for.
Return: classname <String> - The elements current classname.
Get Position
Get the position.
path <String> - Identifier for the element a command should be executed for.
Return: position <String> - The elements current position.
Is Enabled
Check if the element is enabled.
path <String> - Identifier for the element a command should be executed for.
Return: isEnabled <Boolean> - Identifies if the element is enabled or not.
Is Focusable
Check if the element in focusable.
path <String> - Identifier for the element a command should be executed for.
Return: isFocusable <Boolean> - Identifies if the element is focusable or not.


Boolean
Get Property Value As Boolean
Get any property value as boolean.
path <String> - Identifier for the element a command should be executed for.
property <String> - The identifier for a property, for example to get the property value.
Return: isBoolean <Boolean> - Identifies whether the property has a boolean value or not.
Return: value <String> - The current property value.
Is Boolean Property
Check if a property value is boolean.
path <String> - Identifier for the element a command should be executed for.
property <String> - The identifier for a property, for example to get the property value.
Return: isBoolean <Boolean> - Identifies whether the property has a boolean value or not.
Is True
Check if a property value is true.
path <String> - Identifier for the element a command should be executed for.
property <String> - The identifier for a property, for example to get the property value.
Return: isTrue <Boolean> - Identifies whether the property equals true or not. If the value is not true it does not equal false in either case!
Is False
Check if a property value is false.
path <String> - Identifier for the element a command should be executed for.
property <String> - The identifier for a property, for example to get the property value.
Return: isFalse <Boolean> - Identifies whether the property equals false or not. If the value is not false it does not equal true in either case!

Search Subtree

Search Subtree.

Blocks to search the subtree of an element for children.

Search For Property
Search for any property value.
path <String> - Identifier for the element a command should be executed for.
propertyName <String> - The identifier for a property.
propertyValue <String> - The value to identify the child element.
Return: elementFound <Boolean> - True if the specified element could be found, false if not.
Return: foundElement <String> - The XPath to the found element.
Search For Bounding Rectangle
Search for a specific name property.
path <String> - Identifier for the element a command should be executed for.
boundingRectangle <String> - The boundingRectangle of the element.
Return: elementFound <Boolean> - True if the specified element could be found, false if not.
Return: foundElement <String> - The XPath to the found element.
Search For Name
Search for a specific name property.
path <String> - Identifier for the element a command should be executed for.
name <String> - The name of the element.
Return: elementFound <Boolean> - True if the specified element could be found, false if not.
Return: foundElement <String> - The XPath to the found element.
Search For Value
Search for a specific value property.
path <String> - Identifier for the element a command should be executed for.
value <String> - The value of the element.
Return: elementFound <Boolean> - True if the specified element could be found, false if not.
Return: foundElement <String> - The XPath to the found element.

Example

An tutorial on how to use the Windows Automation Plugin can be found here: First Steps with Windows Automation



Copyright © 2014-2016 eXept Software AG