Testing Windows Store Applications - Overview

Applies to TestComplete 14.61, last modified on April 22, 2021

Windows Store applications are a new type of applications that run under Windows 10, Windows 8 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.

TestComplete supports Windows Store applications created with JavaScript, as well as with Visual C#, Visual Basic .NET and Visual C++. These applications are called JavaScript-based and XAML-based respectively.

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 Click operation.

Sample keyword test recorded against a Windows Store application

Click the image to enlarge it.

JavaScript, JScript

function Test1()
{
  var explorer;
  var wnd;
  var page;
  var textbox;
  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();
}

Python

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();

VBScript

Sub Test1
  Dim explorer
  Dim wnd
  Dim page
  Dim textbox
  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)
  Call textbox.SetText("Hello!")
  page.buttonSayHello.ClickButton
End Sub

DelphiScript

procedure Test1;
  var explorer : OleVariant;
  var wnd : OleVariant;
  var page : OleVariant;
  var textbox : OleVariant;
begin
  explorer := Aliases.explorer;
  explorer.wndStart.Click(29, 938);
  wnd := explorer.wndImmersiveLauncher.Start_menu;
  wnd.startgridholder.Start_Apps.ScrollViewer.Apps.Click(18, 23);
  wnd.appsgridholder.All_Apps.ScrollViewer.Content.Group_2.MySampleWinStoreApp.MySampleWinStoreApp.Click(42, 9);
  page := Aliases.MySampleWinStoreApp.BrowserWindow.WebPlatformEmbedding.browser.pageMysamplewinstoreapp;
  textbox := page.textboxNameinput;
  textbox.Click(114, 8);
  textbox.SetText('Hello!');
  page.buttonSayHello.ClickButton;
end;

C++Script, C#Script

function Test1()
{
  var explorer;
  var wnd;
  var page;
  var textbox;
  explorer = Aliases["explorer"];
  explorer["wndStart"]["Click"](28, 936);
  wnd = explorer["wndImmersiveLauncher"]["Start_menu"];
  wnd["startgridholder"]["Start_Apps"]["ScrollViewer"]["Apps"]["Click"](19, 22);
  wnd["appsgridholder"]["All_Apps"]["ScrollViewer"]["Content"]["Group_2"]["MySampleWinStoreApp"]["MySampleWinStoreApp"]["Click"](24, 18);
  page = Aliases["MySampleWinStoreApp"]["BrowserWindow"]["WebPlatformEmbedding"]["browser"]["pageMysamplewinstoreapp"];
  textbox = page["textboxNameinput"];
  textbox["Click"](130, 21);
  textbox["SetText"]("Hello!");
  page["buttonSayHello"]["ClickButton"]();
}

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:

Task See topic…
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, distributed 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:

  • JavaScript-based Windows Store applications contain a built-in web browser window (Internet Explorer) that is used to display the application controls. The internal objects in these applications are recognized as web page elements of the appropriate type (image, link, button, edit box and so on). These objects contain methods and properties that TestComplete provides for test objects, plus methods and properties exposed by the built-in browser:

    Testing Windows Store applications: Properties of a JavaScript-based application in the Object Browser

    Click the image to enlarge it.

  • 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:

    Testing Windows Store applications: Properties of a XAML C# application in the Object Browser

    Click the image to enlarge it.

Note:

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 EnableLUA value set to 1 (1 is the default value):

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

If you changed this value manually, set 1 again to make object recognition work correctly.

See 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.

Sample Name Mapping for a Windows Store application

Click the image to enlarge it.

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 –

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

Test objects that correspond to controls of Windows Store application contain lots of methods and properties. In JavaScript-based Windows Store applications, these are methods and propeties provided by TestComplete as well as methods and properties exposed by the built-in browser. In XAML-based Windows Store applications, these are methods and propeties provided by TestComplete and methods and properties retrieved via UI Automation.

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:

See Also

Testing Windows Store Applications
Requirements for Testing Windows Store Applications

Highlight search results