Windows Store applications are a new type of applications that run under Windows 10 and Windows Server 2012 and are distributed via Windows Store. These applications use the Modern UI style (formerly known as Metro UI). This topic provides an overview of testing Windows Store applications with TestComplete.
General Notes on Testing Windows Store Applications
With TestComplete, you can create any kind of tests for your Windows Store applications: unit, functional, regression and so on. The easiest way to create a test for your application is to record a keyword test or script routine. While playing back a test, TestComplete repeats all the recorded actions you performed with the tested application during the recording. If necessary, you can also extend the recorded test manually using a number of specific features provided by TestComplete.
|To test Windows Store applications, make sure that the Enable support for testing Windows Store application option is enabled in TestComplete. For more information on how to prepare TestComplete for testing Windows Store applications, see Requirements for Testing Windows Store Applications.|
Creating and Recording Tests for Windows Store Applications
With TestComplete, you can record and play back user actions in Windows Store applications, or you can create tests manually from scratch. Usually, it is easier to record the test first and then modify and enhance the recorded test.
When you record a test, you interact with the tested Windows Store application as an end-user would: navigate through the application’s screens, fill out forms and so on. TestComplete captures all actions you perform in the application and adds them to the test.
A test consists of a sequence of operations that define various interactions with objects in the tested application. For example, in the sample test below you can see that a click on a tile that correspond to the tested application is represented by the
explorer = Aliases.explorer;
wnd = explorer.wndImmersiveLauncher.Start_menu;
page = Aliases.MySampleWinStoreApp.BrowserWindow.WebPlatformEmbedding.browser.pageMysamplewinstoreapp;
textbox = page.textboxNameinput;
def Test1(): explorer = Aliases.explorer; explorer.wndStart.Click(28, 938); wnd = explorer.wndImmersiveLauncher.Start_menu; wnd.startgridholder.Start_Apps.ScrollViewer.Apps.Click(15, 22); wnd.appsgridholder.All_Apps.ScrollViewer.Content.Group_2.MySampleWinStoreApp.MySampleWinStoreApp.Click(8, 20); page = Aliases.MySampleWinStoreApp.BrowserWindow.WebPlatformEmbedding.browser.pageMysamplewinstoreapp; textbox = page.textboxNameinput; textbox.Click(86, 21); textbox.SetText("Hello!"); page.buttonSayHello.ClickButton();
Set explorer = Aliases.explorer
Call explorer.wndStart.Click(32, 944)
Set wnd = explorer.wndImmersiveLauncher.Start_menu
Call wnd.startgridholder.Start_Apps.ScrollViewer.Apps.Click(14, 23)
Call wnd.appsgridholder.All_Apps.ScrollViewer.Content.Group_2.MySampleWinStoreApp.MySampleWinStoreApp.Click(22, 5)
Set page = Aliases.MySampleWinStoreApp.BrowserWindow.WebPlatformEmbedding.browser.pageMysamplewinstoreapp
Set textbox = page.textboxNameinput
Call textbox.Click(162, 19)
var explorer : OleVariant;
var wnd : OleVariant;
var page : OleVariant;
var textbox : OleVariant;
explorer := Aliases.explorer;
wnd := explorer.wndImmersiveLauncher.Start_menu;
page := Aliases.MySampleWinStoreApp.BrowserWindow.WebPlatformEmbedding.browser.pageMysamplewinstoreapp;
textbox := page.textboxNameinput;
explorer = Aliases["explorer"];
wnd = explorer["wndImmersiveLauncher"]["Start_menu"];
page = Aliases["MySampleWinStoreApp"]["BrowserWindow"]["WebPlatformEmbedding"]["browser"]["pageMysamplewinstoreapp"];
textbox = page["textboxNameinput"];
The recorded tests can be modified and enhanced in a number of ways to create more flexible and efficient tests. For example, you can:
Add new operations, reorder operations and modify their parameters.
Delete or disable unneeded operations (for example, superfluous recorded operations).
Insert checkpoints for verifying objects and values in the tested application.
Create data-driven tests that run multiple test iterations using different sets of data.
Refer to the following topics to learn more about creating and enhancing tests:
|Creating tests using recording||Recording Tests|
|Creating tests manually||Keyword Testing and Scripting|
|Simulating user actions||Working With Application Objects and Controls|
|Running tests||Running Tests|
|Launching applications automatically at the beginning of the test run||Adding Windows Store Applications to the List of Tested Applications and Running Tested Applications|
|Creating checkpoints for verifying application behavior and state||Checkpoints|
|Running multiple test iterations using data from an external file||Data-Driven Testing|
About Test Types
There are two major test formats in TestComplete:
Keyword tests - visually configured tests with grid-based editing interface. Best suited for novice users and those without programming knowledge.
Scripts - code written in one of the supported scripting languages. May be better suited for advanced users.
You select the test type when creating a test and cannot change it later. However, you can mix keyword tests and scripts within the same test project and call them from each other.
TestComplete also includes additional test types, such as low-level procedures, unit tests, and so on. You can use them to address specific testing needs. However, most automation is typically done using keyword tests and scripts.
Object Recognition and Identification
The way TestComplete recognizes controls of Windows Store applications depends on the technology that was used to create the application:
To expose controls of XAML-based Windows Store applications, TestComplete uses UI Automation. The name of test objects that correspond to these objects contain the UIAObject string and the name defined for the control by the application developer. The objects contain methods and properties provided by TestComplete and methods and properties exposed via UI Automation:
If you face issues with recognition of Windows Store application objects, make sure User Account Control (UAC) is enabled on your Windows machine. The easiest way do that is to open the Windows Registry and check that the following key contains the
If you changed this value manually, set 1 again to make object recognition work correctly.
See instructionsSee instructions
For more information on accessing internal objects, methods and properties of Windows Store applications, see Addressing Objects in Windows Store Applications and Accessing Methods and Properties of Windows Store Objects.
Object Names in Tests
When you are recording a test, TestComplete captures all windows and controls you interact with and adds them to the Name Mapping project item (also known as the object repository or GUI map). For each captured object, TestComplete does the following:
Selects a set of properties and values that uniquely identify the object in the application and saves them to Name Mapping as the object’s identification criteria. These properties will be used to find the object during subsequent test recording, editing and run sessions.
Generates an alias (name) that will be used to reference this object in tests. By default, TestComplete generates aliases based on the object names defined in the application by the developers.
The image below demonstrates sample Name Mapping for a Windows Store application.
Here, the textnodePageTitle object is identified only by its
ObjectType property (TextNode) and by the
idStr property (pageTitle). textnodePageTitle is the name that the application developer defined for the control in the application’s source code. However, Windows Store application objects can also be located by other properties, such as their class name, text and so on -- whatever best identifies a specific object.
If needed, you can modify the default Name Mapping generated by TestComplete. For example, you can –
Change the identification properties and values to define more robust identification criteria or to reflect major GUI changes in newer versions of the tested application.
Rename aliases to more meaningful and descriptive aliases, so that it is easier for you to understand which object is which.
Manually add new objects to Name Mapping.
For more information, see How To.
Keep in mind that the object hierarchy in Name Mapping mirrors the object hierarchy in the tested application. When locating an object, TestComplete takes into account its entire parent hierarchy. If any object in the parent hierarchy cannot be found using the specified property values, the target object cannot be located either. That is why it is important to select unique and unchanging properties for object identification.
Methods and Properties of Test Objects
You can use methods and properties to simulate user actions on controls, or to obtain information about control state. To see what methods and properties are available in your tested application, use the Object Browser or Object Spy. You can view object properties and methods both at design time and at run time when the test is paused.
For more information on working with methods and properties of Windows Store application objects, see Accessing Methods and Properties of Windows Store Objects. For information on browsing objects and their methods and properties, see Object Browser and Exploring Applications.
Where to Go Next
For more information on creating automated tests with TestComplete, see the following sections: