Getting Started With Testcomplete PDF
Getting Started With Testcomplete PDF
* Windows and the Windows logo are trademarks of the Microsoft group of companies.
Desktop applications - these applications are executed on desktop computers running the Windows
operating system.
Web applications - these applications are executed in web browsers (including those web browsers
that are embedded into desktop applications).
This document is for novice users. It provides a brief overview of automated testing and of the product, and
includes tutorials that explain how to create tests for major application types. After you read these tutorials, you
will be able to create, modify and execute tests for desktop, web and mobile applications.
smartbear.com
Table of Contents
Table of Contents
INTRODUCING AUTOMATED TESTING AND TESTCOMPLETE .....................................................5
Automated Testing .........................................................................................................................................5
Test Types.......................................................................................................................................................5
TestComplete Projects and Project Items .......................................................................................................6
TestComplete User Interface ..........................................................................................................................7
TestComplete Test Object Model ...................................................................................................................9
Checkpoints and Stores ................................................................................................................................11
TESTING DESKTOP APPLICATIONS .....................................................................................................12
1. Creating a Test Project .........................................................................................................................13
2. Defining Applications to Test...............................................................................................................14
3. Completing the Project Creation ..........................................................................................................19
4. Creating a Test ......................................................................................................................................21
5. Analyzing the Recorded Test ...............................................................................................................34
6. Running the Recorded Test ..................................................................................................................39
7. Analyzing Test Results .........................................................................................................................41
TESTING WEB APPLICATIONS ...............................................................................................................44
1. Creating a Test Project .........................................................................................................................44
2. Selecting a Test Type ...........................................................................................................................46
3. Completing the Project Creation ..........................................................................................................47
4. Preparing Web Browser........................................................................................................................49
5. Creating a Test ......................................................................................................................................49
6. Analyzing the Recorded Test ...............................................................................................................59
7. Running the Recorded Test ..................................................................................................................62
8. Analyzing Test Results .........................................................................................................................64
9. Running the Test in Multiple Browsers ................................................................................................67
TESTING ANDROID APPLICATIONS .....................................................................................................70
1. Preliminary Steps..................................................................................................................................71
2. Creating a Test Project .........................................................................................................................75
3. Creating a Test ......................................................................................................................................76
4. Analyzing the Recorded Test ...............................................................................................................88
5. Running the Test...................................................................................................................................91
6. Analyzing Test Results .........................................................................................................................93
7. Running Test on Multiple Devices .......................................................................................................96
TESTING IOS APPLICATIONS .................................................................................................................99
1. Preparing iOS Device .........................................................................................................................100
2. Preparing iOS Application for Testing ...............................................................................................101
3. Creating a Test Project .......................................................................................................................103
4. Creating a Test ....................................................................................................................................104
5. Analyzing the Recorded Test .............................................................................................................115
http://support.smartbear.com/
Table of Contents
4
6.
7.
8.
9.
smartbear.com
Gathering the application output and comparing it to expected result (baseline data).
Automated testing is the automatic execution of software testing by a special program with little or no human
interaction. Automated execution guarantees that no test action will be skipped; it relieves testers of having to
repeat the same boring steps over and over.
TestComplete provides special features for automating test actions, creating tests, defining baseline data,
running tests and logging test results. For example, it includes a special recording tests feature that lets you
create tests visually. You just need to start recording, perform all the needed actions against the tested
application and TestComplete will automatically convert all the recorded actions to a test. TestComplete also
includes special dialogs and wizards that help you automate comparison commands (or checkpoints) in your
tests.
Test Types
TestComplete supports various testing types and methodologies: unit testing, functional and GUI testing,
regression testing, distributed testing and others (see Different Ways of Testing in TestComplete Help). In this
tutorial, we will create functional tests - the kind that is used most often. Functional tests check the interface
between the application on one side, and the rest of the system and users on the other side. They verify that the
application functions as expected.
A typical functional test consists of test commands that perform various actions such as simulating clicks and
keystrokes, running test commands in a loop and verifying objects contents.
In TestComplete, functional tests can be created in the form of keyword tests and scripts. Tests of both kinds
can be recorded or created from scratch with built-in editors. Creating keyword tests is visual, easy and does
not require a programming background. Scripting requires understanding script commands, but gives you the
http://support.smartbear.com/
ability to create more powerful and flexible tests. TestComplete supports scripting in VBScript, JScript,
DelphiScript, C++Script and C#Script, so you can create scripts in the language you know best.
In this tutorial, we will use the keyword testing feature.
smartbear.com
For complete information on project items available in TestComplete, see About Project Items in
TestComplete Help.
As you can see, TestCompletes user interface is organized into a number of panels. The Project Explorer
panel (on the left of the window) displays the contents of projects and the project suite. It also provides links to
the test log nodes.
The Workspace panel is your working desktop: it displays the projects and project items editors, where you
create and modify tests and view test results. For instance, on the image above you can see the Keyword Test
editor opened in the Workspace. Below the editor there is a Test Visualizer panel that displays images which
the test engine captured during recording for test commands. These images help you understand the actions
which test commands perform.
http://support.smartbear.com/
Besides the Project Explorer, Workspace and Test Visualizer, TestComplete contains other panels. For
example, the Watch List, Locals, Breakpoints and Call Stack panels are used for test debugging. The To Do
panel manages a list of tasks to be done and the Code Explorer panel provides a convenient way to explore
script contents and navigate through script units.
The Object Browser panel holds one major TestComplete function that does not belong to a specific project: it
shows the list of all processes and windows that exist on the machine. It also lists the processes of mobile
applications, if the mobile device is connected and the application is prepared in a special way. For each
process and window it shows methods and properties accessible externally through TestComplete facilities.
In other words, the Object Browser tells you which objects, methods and properties are available for testing,
and how to get to them. See Exploring Application Properties in TestComplete Help.
To learn about a panel, click within this panel and then press F1. This will open the panels description.
You use menus and toolbars to command TestComplete to perform certain actions. Its menu subsystem is
similar to the menus and toolbars of Microsoft Visual Studio and other popular Windows applications. You can
change the toolbars location, move items from one menu or toolbar to another, hide items, add hidden items
back and perform other tasks. For more information, see Working With TestComplete Toolbars and Menus in
TestComplete Help.
smartbear.com
Note: The images in this topic demonstrate the object model of desktop applications. The object model
of web and mobile applications is similar.
TestComplete uses a tree-like model for test objects. The root node of the tree is Sys, while for mobile
applications, the root node is Mobile.
Process objects correspond to applications running in the operating system. We use the term process rather
than application because it corresponds to the concept of processes in Windows documentation.
http://support.smartbear.com/
10
A process objects name includes the name of the process executable and its index (the index is used only if
several application instances are running):
The processes have child objects windows that correspond to top-level windows. These objects in their turn
have other child window objects that correspond to controls. The window and control names depend on
whether or not the test engine has access to internal methods and properties of the application under test.
TestComplete works with applications of both types, but names their windows and controls in different ways.
Black-box applications
Applications that do not provide access to their internal methods and properties are called black-box
applications. The name of each window of such applications includes the windows class name, the
windows text or title (caption) and its index. Controls are named in the same manner as windows,
because in terms of the operating system, a control is just another type of a window:
smartbear.com
11
White-Box Applications
Applications that expose their internal objects, methods and properties to TestComplete are called
icon in the Object
white-box applications or Open Applications. They are marked with the
Browser (see the image below).
To address windows and controls of Open Applications, TestComplete uses the names that reflect the
window or control type and the name defined in the applications sources. For instance, if you have a
form named MainForm in a C# application created with the Microsoft WinForms library, then
TestComplete will address this form as WinFormsObject("MainForm"):
For detailed information on naming processes, windows and controls, see Naming Objects in TestComplete
Help.
Note: It is recommended that, whenever possible, your tests work with Open Applications rather than
black-box applications. This enables the test engine to access the applications internal methods and
properties, allowing you to create more powerful and flexible tests.
Some applications like .NET, WPF, Visual Basic, Java or Web are always open to TestComplete.
Others may need to be compiled in a special way. For more information on this, see Open
Applications in TestComplete Help.
http://support.smartbear.com/
12
smartbear.com
13
Note: Some file managers can display the Shared Documents and Public Documents folders as
the Documents folder.
The folder stores several Orders projects created with different compilers: C#, Visual C++, Visual Basic,
Delphi, C++Builder, Swing and so on. We will use the Orders application created with Visual C#.
3. On the first page of the wizard, you can specify the project name and location. Enter Orders to the
Project name edit box. TestComplete will automatically generate the project path and display it in
the Location field. The project folder is used to store all information generated for or by the
http://support.smartbear.com/
14
project: keyword tests, scripts, test logs, stores, and so on. You can change the projects folder in
the Location box. In our example we will keep the folder name unchanged.
You can also specify the project suite name and its actual location by clicking the More button and
filling in the corresponding edit fields. In our example, we will keep the project suite name and
location unchanged.
4. After you specify the project name and location, click Next to continue.
We will continue working with the wizard and use its pages to add tested applications to the project and specify
some other project settings.
You can do this with the Create New Project wizard during project creation.
You can do this at any time later by using the context menu of the Project Explorer panel.
TestComplete can also add an application to a project automatically during test recording. The
recorder is smart enough to detect the start of an application through the command line, Windows
Explorer or any other way. After the recording is over, TestComplete will add the tested application to
the list and insert the Run Tested Application command into the recorded test.
In this tutorial, we will add the tested application to the project by using the Create New Project wizard.
smartbear.com
15
1. After you specify the project name and location on the first page of the wizard, the wizard shows
the second page where you can choose the type of your tested application:
This will help TestComplete choose the appropriate run mode for your application.
As you may remember, we are going to test the Orders application written in C# and shipped with
TestComplete. This is an ordinary .NET application that runs as a stand-alone executable. In the
wizard, it falls under the Generic Windows Application category. So, click Generic Windows
Application and, if you use Windows XP, click Next to continue. On Windows Vista and later
versions of the operating system, the wizard will switch to the next page automatically after you
click the category name.
http://support.smartbear.com/
16
2. On the next page of the wizard, you can add the tested application to your test project:
smartbear.com
17
To do this:
Click Add. This will invoke the Parameters dialog in which you specify the launch
parameters of the application under test:
The path to the C# version of the Orders.exe file looks like this:
o
If you are working under Windows Vista, Windows 7 or later operating systems:
C:\Users\Public\Public
Documents\TestComplete
Desktop\Orders\C#\bin\Release\Orders.exe
10
Samples\
Note: Some file managers can display the Shared Documents and Public Documents folders
as the Documents folder.
After you choose Orders.exe, the Parameters dialog will display the full path to the
application. In the dialog, click OK.
http://support.smartbear.com/
18
The wizard will display the Orders applications name and path in the list of tested applications.
3. Make sure that the Autorun check box in the list is selected. If it is selected, TestComplete will
automatically launch the Orders tested application when you start recording tests. If the check box
is clear, then to record user actions over your application you will have to launch the application
manually.
4. After you add the application to the list and verify that the Autorun check box is selected, click
Next to continue.
In the next section, we will go through the rest pages of the wizard and complete the project creation.
smartbear.com
19
Test Visualizer captures information for test actions during test recording and playback.
Depending on the selected options, Test Visualizer frames can contain screenshots only or
screenshots along with information about the objects they contain.
The Visualizer frames that were captured during recording help you better understand what the
recorded test commands do, what is important when you have just started learning the product.
The Visualizer frames captured during test execution let you easily determine what happens to the
tested application or system at that time. This information is helpful when you are debugging
errors.
However, the images and test object data occupy hard disk space and in large projects they may be
the reason of significant increase of the size of test result files. So, you can limit the amount of
http://support.smartbear.com/
20
collected data by capturing images only, or, if Visualizer is not needed, you may disable it and
enable it at any time later using your projects settings.
In our tutorial, we select Capture images only both for test recording and playback. Then, click
Next to continue.
2. On the next page of the wizard, you can choose the scripting language to be used in your project.
Every TestComplete project uses one of the supported scripting languages: VBScript, JScript,
DelphiScript, C++Script or C#Script. The scripting language is important even if you are not
going to use script units in your project. Even if you are going to use only keyword tests, you may
need to call code snippets or use script statements to specify operation parameters.
The scripting language is also important because it defines the format of object names with which
your tests will work, regardless of whether you are using scripts or keyword tests. The name
format depends on the language syntax. For instance, in VBScript and JScript the name of the
Notepad process looks like Process("Notepad"). In DelphiScript you should replace double
quotes with single quotes, that is, Process('Notepad'); and in C++Script and C#Script, the
word Process should be enclosed in brackets: ["Process"]("Notepad").
smartbear.com
21
For more information on choosing the scripting language, see Selecting the Scripting Language
topic in TestComplete Help.
In this tutorial, we will use VBScript. So, select VBScript on the page. On Windows Vista and
later versions of the operating system, this will close the wizard. If you are using Windows XP,
click Finish.
TestComplete will create a new project, Orders.mds, and a project suite for it. It will then display the project
suites and the projects contents in the Project Explorer panel.
Now we can create tests.
4. Creating a Test
Planning a Test for the Orders Application
The sample Orders application maintains a list of orders. Suppose we need to test whether the applications
Edit Order form functions correctly and modifies data in the order list. In this case
Test purpose: The test should check whether the Edit Order form saves the modified data and the
changes are visible in the order list.
Testing steps: Our test should simulate modifying the orders details and then verify the data in the
order list. We will record a test simulating user actions over the application. For simplicity, our test
will change only one property of one order.
Checking and logging the test result: If the change made to the order has been saved correctly, it
should be visible in the order list. To check this, our test will compare the data in the list with an
expected value. We will add a special comparison command to the test for this. This command will
post the comparison results to the test log, so we will see whether the verification failed or passed
successfully.
For more information on planning tests with TestComplete, see Planning Tests in TestComplete Help.
Record tests
When you create a test manually, you enter all the needed commands and actions that your test must perform
via appropriate script objects or keyword test commands. This approach is very helpful when you need to
create very powerful and flexible tests or if you have good experience in creating tests.
However, creating tests manually requires a lot of time and does not prevent you from different problems. For
example, while creating a test manually you must know the classes and names of your application's objects you
want to work with. To solve such problems, TestComplete includes a special feature that lets you easily create
tests. You can perform some actions against the tested application once and TestComplete will automatically
recognize these actions and then convert them to script lines or keyword test operations. We call this feature
http://support.smartbear.com/
22
recording a test, because you create a test visually and in one sense you record the performed actions to a
script or keyword test. It is a very useful approach and it does not require much experience in creating tests. So,
in this tutorial we will demonstrate how to record tests with TestComplete. For more information, see the
section below.
The toolbar contains items that let you perform additional actions during the recording, pause or
stop recording and change the type of the recorded test (keyword test, script code or low-level
procedure).
2. After starting the recording, perform the desired test actions: launch the tested application (if
needed), work with it by clicking command buttons, selecting menu items, typing text and so on.
3. After all the test actions are over, stop the recording by selecting
toolbar.
For complete information on test recording, see the Recording in TestComplete section in TestComplete Help.
smartbear.com
23
Note: Do not switch to the TestComplete help during the recording. The recording engine traces
and records all user actions, so the recorded test will contain commands that simulate
switching.
To see the instructions, you can print them before starting the record. Or, if you have two
monitors, you can move the TestComplete help system window to the other monitor.
We would like to mention that after you start the recording, TestComplete's main window is
automatically minimized, and it cannot be activated until you stop the recording. If you try to
switch to the TestComplete window when the recording is in process, TestComplete
displays a TestComplete is in recording mode and cannot be activated. message. To
continue creating a test, click Continue in this message, and TestComplete will resume the
recording. Note that when the message is shown, TestComplete automatically pauses the
recording, and all your actions against the tested application are not recorded.
Lets start recording:
1. When creating a new project, TestComplete automatically creates an empty keyword test in this
project. Lets record test commands into this test. To start recording, select the
Append to
Test item on the test editors toolbar:
TestComplete will display the Recording toolbar on screen. If the Interactive Help panel is visible,
TestComplete will also show information about the recording in it.
By default, the Recording toolbar is collapsed:
http://support.smartbear.com/
24
Click the
arrow button to expand the Recording toolbar and view all its buttons:
2. After you start the recording, TestComplete automatically launches the Orders tested application that
we added to the projects list of tested applications. This happens, because we enabled the
applications Autorun setting when we were adding the application to the project (see Defining
Applications to Test in TestComplete Help).
If we had disabled this property, we would have had to launch the application manually. You can do
this by selecting the Run command from the Recording toolbar:
You can also launch the application from Windows Explorer or any other file manager. If the
application is not on the list of tested applications, TestComplete will add it there.
TestComplete records the application start using a special application launch test command. You will
see this command later, when we will analyze the recorded test.
smartbear.com
25
3. Wait until the application starts and the applications main window is shown:
If the Interactive Help panel is visible, resize or move it so that it does not overlap the applications
window. Your actions on this panel are not recorded.
4. Switch to the Orders application and select File | Open from its main menu. This will bring up the
standard Open File dialog.
5. In the dialog, open the MyTable.tbl file. The location of this file depends on the operating system you
use.
On Windows Vista, Windows 7 and later operating systems it resides in the
C:\Users\Public\Public Documents\TestComplete 10 Samples\Open Applications folder. On other
operating systems, the file is located in the C:\Documents and Settings\All Users\Shared
Documents\TestComplete 10 Samples\Open Applications folder.
Note: Some file managers can display the Shared Documents and Public Documents
folders as the Documents folder.
It is recommended to type the fully-qualified file name into the File name box of the
Open File dialog. Typing instead of using the mouse will help you avoid problems if
the test is played back on a different operating system or if the Open File dialog
displays a different initial folder when the test is played back later.
http://support.smartbear.com/
26
6. After specifying the file in the File name box, press Open. The Orders application will load data from
the file and display this data in the applications main window.
smartbear.com
27
Edit order. This will call the Order dialog:
9. In the dialog, click within the Customer Name text box to move the insertion point there. Right-click
within the Customer Name box and choose Select All from the context menu and then enter Mark
Twain as the customer name.
10. Click OK to close the dialog. TestComplete will update the customer list in the applications main
window.
11. Now lets insert a comparison command into our test. It will verify that the applications customer list
displays the modified name - Mark Twain.
We call the comparison commands checkpoints. TestComplete offers various types of checkpoints
that are suitable for verifying different types of data (see Checkpoints section in TestComplete Help).
One of the most frequently used checkpoints is a Property checkpoint. It is used to check data of
applications controls. We will use this checkpoint in our tutorial.
http://support.smartbear.com/
28
Select
Create Property Checkpoint from the Checkpoint drop-down list of the
Recording toolbar:
This will invoke the Property Checkpoint wizard. It will guide you through the process of
checkpoint creation:
smartbear.com
29
) with the left mouse button and
Wait until the wizard minimizes and then drag the icon to the customer list of the Orders
application. While you are dragging, TestComplete will highlight the controls and windows
under the mouse cursor with the red frame.
Release the mouse button when the target glyph is over the customer list and it is highlighted
with the red frame:
http://support.smartbear.com/
30
After you release the mouse button, TestComplete will restore the wizard and display the
name of the selected object in the Object box and the image of the object below it:
The next page of the wizard displays a list of the selected objects properties. This list includes
properties provided by TestComplete as well as properties defined by the tested application.
For instance, our tested application was created in C#, so the list includes properties of the
appropriate .NET class. You can see them under the .NET node. In our example the list
contains only a basic set of properties. To view all available properties, click the View more
members (Advanced view) link.
TestComplete appends two groups of properties to the selected object: one group includes
properties common for all tested windows and controls. You can see them under the
Standard node. Another group includes properties that are specific to list-view controls (since
the object we selected is a tree view control). The names of these properties start with the letter
w. You can see them under the Extended node. To verify the data, we will use the
wItem property. It provides access to individual items of tree view controls.
smartbear.com
31
Find the wItem property in the list (it is under the node Extended). Click its Params button. The
following window will pop up:
In this window, specify the cell holding the Mark Twain string:
Enter 5 into the Item box (5 is the index of the Mark Twain item in the tree view. Indexes
are zero-based).
Click OK.
The test engine will retrieve the items data and display it in the property list:
http://support.smartbear.com/
32
smartbear.com
33
On the next page of the wizard you can see the name of the property, whose value will be
verified, the comparison condition and baseline data in the Value box:
Click Finish to complete the checkpoint creation. TestComplete will append the checkpoint command
to the recorded test.
12. Close the Orders window by clicking the X button on the windows caption bar. This will display the
dialog asking if you want to save changes. Press No. Orders will close.
13. Press
Stop on the Recording toolbar to stop the recording. TestComplete will process the
recorded test commands and save them to a test.
http://support.smartbear.com/
34
The recorded test is similar to the test shown in the image above. Your actual test may differ from this one. For
example, it may have other object names or window indexes if you have recorded the test on a Visual C++ or
Delphi application.
The test contains the commands that correspond to the actions you performed on the Orders application during
the recording. We call the test commands operations.
smartbear.com
35
Below the commands there is the Test Visualizer panel that displays images which TestComplete captured for
operations during test recording:
These images illustrate the recoded operations and help you better understand which action the operation
performs. TestComplete captures images only for those operations that correspond to user actions (mouse
clicks, typing text and so on).
When you choose an operation in the editor, Test Visualizer automatically selects the appropriate image so you
can easily explore the application state before the operation is executed. For more information on working with
images, see the topics in the Test Visualizer section in TestComplete Help.
http://support.smartbear.com/
36
To view the needed image closely, double-click it in the Test Visualizer panel. The Visualizer Frame window
will appear. This window lets you perform additional actions against the captured images. For example, you
can zoom them in and out, save them to a file, navigate through the images, and so on. For more information,
see the window description in TestComplete Help.
The first operation in the test is Run TestedApp. It is used to launch the tested application (in our case, it is the
Orders application) from a keyword test. TestComplete automatically records this operation when it launches
the application automatically or detects an application launch from the Recording toolbar or somewhere from
the operating systems UI.
smartbear.com
37
The next operation corresponds to the selection of the File | Open menu item.
The next operation simulates opening the file via the Open File dialog:
If your computer is running Windows Vista, Windows 7 or later operating system, TestComplete records a
sequence of operations that simulate actions you perform when working with the Open File dialogs controls.
Note: It is recommended to type the full name of the file you want to open in the File name box of the Open
file dialog instead of navigating to the file using the dialogs controls. This approach lets you record a
test that will be executed successfully regardless of the operating system, navigation bars and panels
available in the dialog and of the path displayed in the dialog.
If your test contains a sequence of operations simulating actions over the Open File dialog, you can
modify the test and manually replace those operations with the OpenFile method call.
After that, there follow operations that simulate your actions with the applications main window and the Order
form:
For more information on simulating mouse events, keyboard input and other actions from your scripts, see
Simulating User Actions in TestComplete Help.
http://support.smartbear.com/
38
Then there is the comparison operation that we added during test recording:
Finally, there is the operation that closes the Orders application and the operation that simulates the No
button press in the message box.
As you can see, TestComplete automatically organizes the operations into groups that correspond to the
processes and windows that you worked with. Grouping makes the test structure easier to understand and also
provides some information on the object hierarchy that exists in the application under test.
We recorded user actions on one process (Orders). So, we have only one process group node. It contains all
of the actions that you simulated on the process windows and controls. The actions that we performed on
windows and controls of the Orders process are organized into a number of window grouping nodes:
You may notice that the names of the tested process and its windows and controls differ from the names that we
saw in the Object Browser panel in one of the previous steps. For instance, in the Object Browser the tested
process was named Process("Orders") while in the test it is called Orders; the main window was called
WinFormsObject("MainForm") while in the test it is called MainForm, and so on.
There is a logical reason for this: By default TestComplete automatically generates and uses custom names for
the objects that you worked with during test recording. Generating and assigning custom names is called name
mapping. TestComplete maps the names because the default names may be difficult to understand. It may be
hard to determine which window or control corresponds to a name. Using mapped names makes the test
smartbear.com
39
easier-to-understand and more stable. For more information on mapping names, see Name Mapping in
TestComplete Help.
The test engine will minimize TestCompletes window and start executing the tests commands. In our case,
the test will simply repeat your recorded actions.
Note: Dont move the mouse or press keys during the test execution. Your actions may interfere
with actions simulated by TestComplete and the test execution may go wrong.
After the test execution is over, TestComplete will restore its window and display the test results. In the next
step we will analyze them.
Some notes about the test run:
The created tests are not compiled into an executable for test runs. You run the tests directly from
TestComplete. To run tests on computers that do not have TestComplete installed, you can use a
resource-friendly utility called TestExecute. You can also export script code (if you use it) to an
external application and run it there. For more information on this, see Connected and Self-Testing
Applications in TestComplete Help.
http://support.smartbear.com/
40
During test execution, TestComplete displays an indicator in the top right corner of the screen:
The indicator displays messages informing you about the simulated test actions.
TestComplete executes the test commands until the test ends. You can stop the execution at any time
by pressing
menu.
Stop on the Test Engine toolbar or select Test | Stop from TestCompletes main
To launch the test we used the Run Test button on the test editors toolbar. This is only one of several
possible ways to run the test. You can also run tests from the Project Explorer, or from another test.
You can also use the Test Items page of the project editor to create a batch run.
For complete information on running tests in TestComplete, on project settings that affect the runs and on the
test execution, see Running Tests in TestComplete Help.
smartbear.com
41
Note that TestComplete automatically adds nodes for the last results after the test execution is over. That is, the
results are not displayed when the test is running (you can view intermediate results if you pause the test
execution).
Since we have run only one test so far, we have only one log node in the Project Explorer. By default,
TestComplete automatically opens the contents of this node in the Workspace panel. You can also view the
log at any time. To do this, right-click the desired result in the Project Explorer panel and choose Open from
the context menu.
http://support.smartbear.com/
42
The log window shows the results of one test run at a time. On the left side of the window, there is a tree-like
structure of the tests that were executed during the run; the node of each of these tests can be selected to view
their results. For our example, we have run only one test, so in our case this tree only contains one node. The
nodes icon indicates whether the test passed successfully or failed.
The test log contains error, warning, informative and other types of messages. The icon on the left indicates the
message type. Using the check boxes at the top of the message list you can hide or view messages by type.
For each message, the log also shows the time that each action was performed. You can see it in the Time
column.
TestComplete may post additional text and images along with the message. To view them, simply select the
desired message in the log and look in the Additional Information and Picture panes that are below the
message list. For instance, on the image above the Picture pane displays the screenshots associated with The
menu item 'Orders|Edit order...' was clicked message.
The Picture panel displays the images that show the expected and actual application state before executing the
selected test command (Expected is the image that was captured for the command during test recording,
actual means the image that was captured during test run.) The test log includes a special button that lets you
compare the images and easily see the difference. This simplifies the search for errors that may occur in your
test. For more information, see topics of the Test Visualizer section in TestComplete Help.
The logs Call Stack pane displays the hierarchy of test calls that led to posting the selected message to the log.
smartbear.com
43
The logs Performance Counters pane displays values of the performance counters monitored during the test
run. The values are shown in the form of graphs.
To view a test operation that posted a message to the log, double-click the desired message in the log.
TestComplete will open the keyword test in the editor and highlight the appropriate operation. For instance, if
you double-click the The menu item Orders|Edit order was clicked message in the log, TestComplete
will highlight the keyword test operation that performed this action:
For detailed information on the test log panels, on posting messages to the log and on working with the results,
see Test Results section in TestComplete Help.
Note: The log that we described is typical for TestComplete keyword tests and scripts. Tests of other types
may form a log of a different structure. For detailed information about these logs, see the
description of the appropriate project item, or simply click within the log page and press F1.
Resolving Errors
Your test may fail. There can be several possible reasons for this. For instance, developers could change the
applications behavior, the recognition attributes of windows and control change and make the test engine fail
to find the needed objects, a third-party application may overlap windows of your application and make the test
engine fail to simulate actions on them, and so on.
One of the most typical reasons which novice users face is the difference in the applications state during the
test creation and playback. To avoid this problem, make sure that the initial conditions of the test run
correspond to those you had when creating the test. For instance, if the tested application had been running
before you recorded the test, it also must be running before you run the test; if the tested web page was opened
on the second tab of your web browser when you recorded your test, it should also be opened on the second tab
when you run the test, and so on.
For information on searching for the cause of errors and resolving typical problems, see Handling Playback
Errors in TestComplete Help.
2014 SmartBear Software
http://support.smartbear.com/
44
smartbear.com
45
2. Select File | New | New Project from TestCompletes main menu. This will call up the Create New
Project wizard:
3. On the first page of the wizard, you can specify the project name and location. Enter WebOrders into
the Project name edit box. TestComplete will automatically generate the project path and display it in
the Location field. The project folder is used to store all information generated for or by the project:
keyword tests, scripts, test logs, stores, and so on. You can change the projects folder in the Location
box. In our example we will keep the folder name unchanged.
You can also specify the project suite name and its actual location by clicking the More button and
filling in the corresponding edit fields. In our example, we will keep the project suite name and
location unchanged.
4. After you specify the project name and location, click Next to continue.
We will continue working with the wizard and use its pages to select the needed project type and specify some
project settings.
http://support.smartbear.com/
46
You can do that with the Create New Project wizard while creating the project. In this case,
TestComplete will generate the project structure that corresponds to the selected test type right after
you finish creating the project.
You can do that at any time later manually by adding needed items via the context menu of the Project
Explorer panel.
In this tutorial, we will generate the required project structure by using the Create New Project wizard.
1. After you specify the project name and location on the first page of the wizard, the wizard shows the
second page where you can choose the type of your tested application:
As you may remember, we are going to test the Web Orders application that is located on the web
page. In the wizard, it falls under the Web category. So, click Functional testing of web pages and, if
smartbear.com
47
you use Windows XP, click Next to continue. On Windows Vista and later versions of the operating
system, the wizard will switch to the next page automatically after you click the category name.
In the next topic, we will go through the rest pages of the wizard and complete the project creation.
Test Visualizer captures information for test actions during test recording and playback. Depending on
the selected options, Test Visualizer frames can contain screenshots only or screenshots along with
information on the objects they contain.
The Visualizer frames that were captured during recording help you better understand what the
recorded test commands do, what is important when you have just started learning the product.
http://support.smartbear.com/
48
The Visualizer frames captured during test execution let you easily determine what happens to the
tested application or system at that time. This information is helpful when you are debugging errors.
However, the images and object data occupy hard disk space and in large projects they may be the
reason of significant increase of the size of test result files. So, you can limit the amount of collected
data by capturing images only, or, if Visualizer is not needed, you may disable it and enable it at any
time later using your projects settings.
In our tutorial, we select Capture images only both for test recording and for playback. Then, click
Next to continue.
2. On the next page of the wizard, you can choose the scripting language to be used in your project.
Every TestComplete project uses one of the supported scripting languages: VBScript, JScript,
DelphiScript, C++Script or C#Script. The scripting language is important even if you are not going to
use script units in your project. Even if you are going to use only keyword tests, you may need to call
code snippets or use script statements to specify operation parameters.
The scripting language is also important because it defines the format of object names with which your
tests will work, regardless of whether you are using scripts or keyword tests. The name format depends
on the language syntax. For instance, in VBScript and JScript the name of the Internet Explorer
smartbear.com
49
process looks like Browser("iexplore"). In DelphiScript you should replace double quotes
with single quotes, that is, Browser('iexplore'); and in C++Script and C#Script, the word
Process should be enclosed in brackets: ["Browser "]("iexplore").
For more information on choosing the scripting language, see Selecting the Scripting Language in
TestComplete Help.
In this tutorial, we will use VBScript. So, select VBScript on the page. On Windows Vista and later
versions of the operating system, this will close the wizard. If you are using Windows XP, click
Finish.
TestComplete will create a new project, WebOrders.mds, and a project suite for it. It will then display the
project suites and the projects contents in the Project Explorer panel.
Now, we need to prepare the web browser for further test steps.
5. Creating a Test
Planning a Test for the Web Orders Application
The sample Web Orders application works with a list of orders. Suppose you need to test whether the
applications Edit Order page functions properly and modifies data in the order list. In this case
Test purpose: The test should check whether the Edit Order page saves the modified data and the
changes are visible in the order list.
Testing steps: Our test should simulate modifying the orders details and then verify the data in the
order list. We will record a test simulating user actions over the application. For simplicity, our test
will change only one property of one order.
Checking and logging the test result: If the change made to the order has been saved correctly, it
should be visible in the order list. To check this, our test will compare the data in the list with an
expected value. We will add a special comparison command to the test for this. This command will
post the comparison results to the test log, so we will see whether the verification failed or passed
successfully.
For more information on planning tests with TestComplete, see Planning Tests in TestComplete Help.
http://support.smartbear.com/
50
Record tests
When you are creating a test manually, you enter all the needed commands and actions that your test must
perform via appropriate script objects or keyword test commands. This approach is very helpful when you need
to create very powerful and flexible tests or if you are experienced in creating tests.
However, creating tests manually requires much time and does not prevent you from different kinds of
problems. For example, when creating tests manually, you must know the classes and names of your
application's objects you want to work with. To solve such problems, TestComplete includes a special feature
that lets you create tests easily: you just perform some actions against the tested application, TestComplete
recognizes these actions and then converts them to appropriate script lines or keyword test operations. We call
this feature "recording a test", because you create a test visually and in one sense you record your actions as
script or a keyword test. It is a very useful approach and it does not require much experience in creating tests.
So, in this tutorial, we demonstrate how to record tests with TestComplete. For more information on recording
tests, see the section below.
The toolbar contains items that let you perform additional actions during the recording, pause or stop
recording and change the type of the recorded test (from the keyword test to script code, or vice versa).
2. After you start recording, perform the desired test actions: launch the desired browser and load a page
to it (if needed), then click some command buttons on the page, select menu items, type some text and
so on.
3. After all the test actions are over, stop the recording by selecting
toolbar.
For complete information on test recording, see Recording in TestComplete in the Help.
smartbear.com
51
TestComplete will display the Recording toolbar on screen. If the Interactive Help panel is visible,
TestComplete will also show information about the recording in it.
By default, the Recording toolbar is collapsed:
Click the
arrow button to expand the Recording toolbar and view all its buttons:
2. Launch
the
desired
browser
and
navigate
http://support.smartbear.com/samples/testcomplete10/weborders/ web page.
it
to
the
http://support.smartbear.com/
52
TestComplete records the browser launch by using a special test command. You will see the command
later when we analyze the recorded test.
3. Wait until the Internet browser starts and the applications login window is shown:
If the Interactive Help panel is visible, resize or move it so that it does not overlap the applications
window. Your actions on this panel are not recorded.
4. Log in to the application using the information shown at the bottom of the page:
Username: Tester
Password: test
smartbear.com
53
5. Now, the browser shows the default page of the application - the page that contains all the existing
orders. Now, let's modify one of the . For this purpose, click the
by Samuel Clemens. This will open the Edit Order page.
6. In the window, click within the Customer name text box and enter Mark Twain as the customer name.
7. Click Update to close the editing page. The application will update the customer list shown in the
main window.
8. Now lets insert a comparison command into our test. It will verify that the applications customer list
displays the modified name - Mark Twain.
We call the comparison commands checkpoints. TestComplete offers various types of checkpoints
that are suitable for verifying different types of data (see Checkpoints). One of the most frequently
used checkpoints is a Property checkpoint. It is used to check data of applications controls. We will
use this checkpoint in our tutorial.
http://support.smartbear.com/
54
Select
Create Property Checkpoint from the Checkpoint drop-down list of the
Recording toolbar:
This will invoke the Property Checkpoint wizard. It will guide you through the process of
checkpoint creation:
smartbear.com
55
) with the left mouse button and
Wait until the wizard minimizes and then drag the icon to the cell that contains the Mark
Twain string. While you are dragging, TestComplete will highlight the controls and windows
under the mouse cursor with the red frame.
Release the mouse button when the target glyph is over the first cell of the Name column and
when it is highlighted with a red frame:
http://support.smartbear.com/
56
After you release the mouse button, TestComplete will restore the wizard and display the
name of the selected object in the Object box and the image of the object below it:
smartbear.com
57
The next page of the wizard displays a list of the selected objects properties. This list includes
properties provided by TestComplete as well as properties defined by the tested application.
To view all available properties, click the View more members (Advanced View) link.
TestComplete appends three groups of properties to the selected object: one group includes
properties common for all tested windows and controls. You can see them under the Standard
node. Another group includes properties that are specific to grid controls (since the object we
selected is a grid control). You can see these properties under the Extended node. The third
group includes the properties provided by the Internet browser. You can see these properties
under the node with the name of the used browser. To verify the data, we will use the
contentText browser-independent property. It provides access to the text shown in the
selected cell and helps you avoid problems with playing back the test in different browsers.
Find the contentText property in the list. Select this property and then click Next to
continue.
http://support.smartbear.com/
58
On the next page of the wizard you can see the name of the property, whose value will be
verified, the comparison condition and baseline data in the Value box:
Click Finish to complete the checkpoint creation. TestComplete will append the checkpoint
command to the recorded test.
9. Click the Logout link in the upper-right corner of the page.
10. Close the Internet browser by clicking the X button on its caption bar.
11. Press
Stop on the Recording toolbar to stop the recording. TestComplete will process the
recorded test commands and save them to a test.
smartbear.com
59
The recorded test is similar to the test shown in the image above. Your actual test may differ from this one. For
example, it may contain some unnecessary clicks.
The test contains the commands that correspond to the actions you performed on the Web Orders application
during the recording. We call the test commands operations.
http://support.smartbear.com/
60
Below the commands there is the Test Visualizer panel that displays images which TestComplete captured for
operations during test recording:
These images illustrate the recorded operations and help you better understand which action the operation
performs. TestComplete captures images only for those operations that correspond to user actions (mouse
clicks, typing text and so on).
When you choose an operation in the editor, Test Visualizer automatically selects the appropriate image so you
can easily explore the application state before the operation is executed. For more information on working with
images, see the topics in the Test Visualizer section.
The first operation in the test is Run Browser. It launches the Internet browser and navigates to the specified
page from a keyword test. TestComplete automatically records this operation when it detects a browser launch.
The second operation waits for the web page to load completely in the web browser. The highlighted operation
waits for the Login page of the Web Orders application. The other operations of this type wait for other web
pages.
smartbear.com
61
Then there are operations that simulate opening the Edit Order page and modifying the Customer Name field:
For more information on simulating mouse events, keyboard input and other actions from your scripts, see
Simulating User Actions in TestComplete Help.
Then there is the comparison operation that we added during test recording:
Finally, there are operations that log out from the Web Orders application and close the browser:
As you can see, TestComplete automatically organizes the operations into groups that correspond to the
processes and windows that you worked with. Grouping makes the test structure easier to understand and also
provides some information on the object hierarchy that exists in the application under test.
http://support.smartbear.com/
62
We've recorded user actions for one browser. So, we have a single group node for the browser. It contains all
the actions that you simulated on the browser windows and controls. The actions that you performed on
different web pages are organized into a number of page group nodes:
You may notice that the name of the Internet browser and the names of its pages and page elements differ from
the names that you can see in the Object Browser panel. For instance, in the Object Browser, the name of the
Internet browser is Browser("iexplore"), Browser("firefox"), Browser("chrome") or Browser("opera")
(depending on which browser you use), while in the test, the Internet browser is simply called a browser.
Another
example
the
Login
page
in
the
Object
Browser
is
called
Page("http://support.smartbear.com/Samples/TestComplete10/WebOrders/Login.aspx"), while in the test, its
name is much shorter: pageWebOrdersLogin.
There is a logical reason for this: by default TestComplete automatically generates and uses custom names for
the objects that you worked with during test recording. Generating and assigning custom names is called name
mapping. TestComplete maps the names because the default names may be difficult to understand. It may be
hard to determine which window or control corresponds to a name. Using mapped names makes the test
easier-to-understand and more stable. For more information on mapping names, see Name Mapping in
TestComplete Help.
smartbear.com
63
Run Test on the test editors toolbar:
The test engine will minimize TestCompletes window and start executing the tests commands. In our case,
the test will simply repeat your recorded actions.
Note: Dont move the mouse or press keys during the test execution. Your actions may interfere with
actions simulated by TestComplete and the test execution may go wrong.
After the test execution is over, TestComplete will restore its window and display the test results. In the next
step we will analyze them.
Some notes about the test run:
The created tests are not compiled into an executable for test runs. You run the tests directly from
TestComplete. To run tests on computers that do not have TestComplete installed, you can use a
resource-friendly utility called TestExecute. You can also export script code (if you use it) to an
external application and run it there. For more information on this, see Connected and Self-Testing
Applications in TestComplete Help.
During test execution, TestComplete displays an indicator in the top right corner of the screen:
The indicator displays messages informing you about the simulated test actions.
TestComplete executes the test commands until the test ends. You can stop the execution at any time
by pressing
Stop on the Test Engine toolbar or in the indicator, or by selecting Test | Stop from
TestCompletes main menu.
Pause. During the pause, you can perform any
You can pause the test execution by clicking
actions needed. For instance, you can explore the test log or check the tests variables and objects using
TestCompletes Watch List or Locals panel or the Evaluate dialog (see Debugging Tests in
TestComplete Help).
For complete information on running tests in TestComplete, on project settings that affect the runs and on the
test execution, see Running Tests in TestComplete Help.
http://support.smartbear.com/
64
Note that TestComplete automatically adds nodes for the last results after the test execution is over. That is, the
results are not displayed when the test is running (you can view intermediate results if you pause the test
execution).
Since we have run only one test so far, we have only one log node in the Project Explorer. By default,
TestComplete automatically opens the contents of this node in the Workspace panel. You can also view the log
at any time. To do this, right-click the desired result in the Project Explorer panel and choose Open from the
context menu.
smartbear.com
65
The log window shows the results of one test run at a time. On the left side of the window, there is a tree-like
structure of the tests that were executed during the run; the node of each of these tests can be selected to view
their results. For our example, we have run only one test, so in our case this tree only contains one node. The
nodes icon indicates whether the test passed successfully or failed.
The test log contains error, warning, informative and other types of messages. The icon on the left indicates the
message type. Using the check boxes at the top of the message list you can hide or view messages by type.
For each message, the log also shows the time that each action was performed. You can see it in the Time
column.
TestComplete may post additional text and images along with the message. To view them, simply select the
desired message in the log and look in the Additional Info and Picture panes that are below the message list.
The Picture panel displays the images that show the expected and actual application state before executing the
selected test command (Expected is the image that was captured for the command during test recording,
actual means the image that was captured during test run.) The test log includes a special button that lets you
compare the images and easily see the difference. This simplifies the search for errors that may occur in your
test. For more information, see topics of the Test Visualizer section in TestConlete Help.
The logs Call Stack pane displays the hierarchy of test calls that led to posting the selected message to the log.
http://support.smartbear.com/
66
The logs Performance Counters pane displays values of the performance counters monitored during the test
run. The values are shown in the form of graphs.
To view a test operation that posted a message to the log, double-click the desired message in the log.
TestComplete will open the keyword test in the editor and highlight the appropriate operation. For instance, if
you double-click the The button was clicked with the left mouse button message in the log, TestComplete
will highlight the keyword test operation that performed this action:
For detailed information on the test log panels, on posting messages to the log and on working with the results,
see the About Test Log section in TestComplete Help.
Note: The log that we described is typical for TestComplete keyword tests and scripts. Tests of other
types may form a log of a different structure. For detailed information about these logs, see the
description of the appropriate project item, or simply click within the log page and press F1.
Resolving Errors
Your test may fail. There can be several possible reasons for this. For instance, developers could change the
applications behavior, the recognition attributes of windows and control change and make the test engine fail
to find the needed objects, a third-party application may overlap windows of your application and make the test
engine fail to simulate actions on them, and so on.
One of the most typical reasons which novice users face is the difference in the applications state during the
test creation and playback. To avoid this problem, make sure that the initial conditions of the test run
correspond to those you had when creating the test. For instance, if the tested application had been running
before you recorded the test, it also must be running before you run the test; if the tested web page was opened
on the second tab of your web browser when you recorded your test, it should also be opened on the second tab
when you run the test, and so on.
For information on searching for the cause of errors and resolving typical problems, see Handling Playback
Errors in TestComplete Help.
smartbear.com
67
Right-click the Run Browser operation and select Make Browser Loop from the context menu.
In the ensuing operation parameters dialog, select Iterate Through All Browsers and press Finish.
This will convert the Run Browser operation into the Browser Loop operation.
http://support.smartbear.com/
68
Select all the test operations that go after the Browser Loop operation and click
the loop. Now these operations will be executed on each loop iteration.
Save the test by selecting File | Save from TestCompletes main menu.
Prepare and configure another browser as described in the Preparing Web Browsers section in TestComplete
help.
Now run the resulting test.
TestComplete will repeat the test operations several times. Each time, the test actions will be performed in a
different browser.
The test log contains information about which browser was used and the results of the test operations
performed in each browser.
smartbear.com
69
For more information on cross-browser testing with TestComplete, see Cross-Browser Testing Overview in
TestComplete help.
http://support.smartbear.com/
70
The application should be deployed to the mobile device as described in the further steps of the tutorial.
smartbear.com
71
1. Preliminary Steps
This section describes the preliminary actions you need to perform to prepare the environment for testing
Android applications with TestComplete.
Note: With TestComplete you can test mobile applications that are running on physical devices,
emulators and Android-x86 virtual machines. You cannot run tests on Android Wear devices.
In this section we will provide instructions on preparing for testing on a physical device.
Preparatory actions for Android emulators and Android-x86 virtual machines are somewhat
different (see Preparing Devices, Emulators and Virtual Machines section in TestComplete
Help). With this exception, the rest of the testing actions are performed in the same manner.
http://support.smartbear.com/
72
6. In the SDK Manager, select the following items:
7. Click Install packages, accept the license agreements and proceed with the installation.
8. Close the SDK Manager.
Configuring TestComplete
smartbear.com
73
Once the plug-ins are active, you may need to specify paths to JDK and Android SDK in TestComplete
settings. The TestComplete installation wizard tries to find these paths automatically on your computer. If it is
unable to do so, you may need to manually specify these paths in TestComplete.
To check whether the paths are specified correctly:
1. Launch TestComplete
2. Select Tools | Options from TestCompletes main menu. This will open the Options dialog.
3. On the left of the dialog, select the Engines | Mobile | Android category.
4. In the Path to Android SDK edit box, specify the folder where you installed the Android SDK on
your computer.
5. In the Path to Java Runtime edit box, specify the folder where Java is installed on your computer.
http://support.smartbear.com/
74
USB debugging - Enables communication between the device and Android Debug Bridge
(ADB). In other words, it makes your device visible to ADB and TestComplete.
Stay awake - Prevents the device from going into sleep mode during debugging.
The Mobile Screen window will open if at least one mobile device or virtual machine is connected to Android
Debug Bridge.
If you have several devices or virtual machines connected, a click on the Show Mobile Screen item will open
the Select Current Device dialog that lists the connected devices. Check whether your device or virtual
machine is on the list, select it there and click OK to view its screen.
Open the Mobile Screen window (if you have not opened it yet)
Press the
smartbear.com
75
Click the Add. The Add Android Tested Application wizard will appear.
http://support.smartbear.com/
76
C:\Users\Public\Public
Documents\TestComplete
Samples\Mobile\Android\Orders\Orders Application\bin\Orders.apk
10
10
Note: Some file managers can display the Shared Documents and Public Documents
folders as the Documents folder.
Select the Deploy to the device on start check box to install the application on the device every
time you launch the application from TestComplete.
Clear the Keep the data and cache directories on removal check box. This will guarantee the
same initial state of the tested application.
Make sure that the Autorun check box on the list is selected. If it is selected, TestComplete will
automatically launch the Orders tested application on the mobile device when you start
recording tests. If the check box is clear, then, to record user actions over your application, you
will have to launch the application manually.
3. Creating a Test
Creating Tests in TestComplete
TestComplete allows you to create tests in two ways. You can:
Record tests
When you create a test manually, you enter all the needed commands and actions that your test must perform
via appropriate script objects or keyword test commands. This approach is very helpful when you need to
create very powerful and flexible tests or if you have good experience in creating tests.
However, creating tests manually requires a lot of time and does not prevent you from different problems. For
example, while creating a test manually you must know the classes and names of your application's objects you
want to work with. To solve such problems, TestComplete includes a special feature that lets you easily create
tests. You can perform some actions against the tested application once and TestComplete will automatically
recognize these actions and then convert them to script lines or keyword test operations. We call this feature
smartbear.com
77
"recording a test", because you create a test visually and in one sense you record the performed actions to a
script or keyword test. It is a very useful approach and it does not require much experience in creating tests. So,
in this tutorial we will demonstrate how to record tests with TestComplete.
The Mobile Screen window displays the screen of the connected mobile device. This window is used
to record tests against mobile applications. The window is displayed if the Automatically display
Mobile Screen on recording option is enabled.
4. After starting the recording, perform the desired test actions: launch the tested application (if needed),
work with the application as you normally do: select menus, touch buttons and other controls and so
on.
5. After all the test actions are over, stop the recording by selecting
toolbar.
For complete information on test recording, see Recording in TestComplete in the Help.
Test purpose: The test should check whether the Edit Order page saves the modified data and the
changes are visible in the order list.
Testing steps: Our test should simulate modifying order details and then verify data in the order list.
For simplicity, our test will change only one property of one order.
Checking and logging the test result: If the change made to the order has been saved correctly, it
should be visible in the order list. To check this, our test will compare the data in the list with the
http://support.smartbear.com/
78
expected value. We will add a special comparison command to the test for this. This command will
post comparison results to the test log, so we will see whether verification failed or passed
successfully.
For more information on planning tests with TestComplete, see Planning Tests in TestComplete Help.
TestComplete will display the Recording toolbar on screen. If the Interactive Help panel is visible,
TestComplete will also show information about the recording in it.
smartbear.com
79
Click the
arrow button to expand the Recording toolbar and view all its buttons:
4. After you start the recording, TestComplete will automatically deploy the Orders application to the
mobile device and start this application. This happens, because we have enabled the applications
Deploy to the device on start and Autorun settings while creating the test project on the previous step.
If we had disabled the Autorun property, we would have had to launch the application manually. You
can do this by selecting the Run Tested Application command from the Recording toolbar:
You can also launch the application from the Run Apps drop-down menu on the Mobile Screen
windows toolbar.
TestComplete records the application start using a special application launch test command. You will
see this command later, when we will analyze the recorded test.
http://support.smartbear.com/
80
5. Wait until the Android Orders application installs and starts on the mobile device. The Mobile Screen
window will display the initial window of the application:
If the Interactive Help panel is visible, resize or move it so that it does not overlap the Mobile Screen
window. Your actions on this panel are not recorded.
6. In the Mobile Screen window, click Samuel Clemenss order.
smartbear.com
81
7. Click the Edit button of the Orders application. This will invoke the Edit Order screen:
http://support.smartbear.com/
82
10. Now lets insert a comparison command into our test. It will verify that the applications customer list
displays the modified name - Mark Twain.
We call the comparison commands checkpoints. TestComplete offers various types of checkpoints
that are suitable for verifying different types of data (see Checkpoints section in TestComplete Help).
One of the most frequently used checkpoints is the Property checkpoint. It is used to check data of
application controls. We will use this checkpoint in our tutorial.
Select
Create Property Checkpoint from the Checkpoint drop-down list of the
Recording toolbar:
This will invoke the Property Checkpoint wizard. It will guide you through the process of
checkpoint creation:
smartbear.com
83
Wait until the wizard minimizes and then drag the icon to the orders list of the Orders
application. While you are dragging, TestComplete will highlight the controls and windows
under the mouse cursor with the red frame.
Release the mouse button when the target glyph is over the order made by Mark Twain and
when the entire item is highlighted with the red frame:
After you release the mouse button, TestComplete will restore the wizard and display the
name of the selected object in the Object box and the image of the object below it:
http://support.smartbear.com/
84
The next page of the wizard displays a list of the selected objects properties and fields. This
list includes properties provided by TestComplete, as well as properties and fields defined by
the tested application.
To verify the data, we will use several native fields defined by the application. To view the
objects fields, click the View more members (Advanced View) link and then switch to the
Fields tab.
smartbear.com
Type mText1 in the Search box. TestComplete will filter out the members according to the
text you type.
85
Select the mText1 field. This field refers to an object. To view the members of this object,
press the ellipsis button.
http://support.smartbear.com/
86
Switch to the Fields tab and type mText in the Search box.
Find the mText property in the list. Select this property and then click Next to continue.
smartbear.com
87
On the next page of the wizard you can see the name of the property whose value will be
verified, the comparison condition and baseline data in the Value box:
Stop on the Recording toolbar to stop the recording. TestComplete will process
the recorded test commands and save them to a test.
http://support.smartbear.com/
88
The recorded test is similar to the test shown in the image above. Your actual test may differ from this one. For
example, it may contain some unnecessary touch actions.
The test contains the commands that correspond to the actions you performed on the Orders application during
the recording. We call the test commands operations.
Below the commands there is the Test Visualizer panel that displays images which TestComplete captured for
operations during test recording:
smartbear.com
89
These images illustrate the recorded operations and help you better understand which action the operation
performs. TestComplete captures images only for those operations that correspond to user actions (touching,
dragging, typing text and so on).
When you choose an operation in the editor, Test Visualizer automatically highlights the appropriate image so
you can easily explore the application state before the operation is executed. For more information on working
with images, see the topics in the Test Visualizer section in TestComplete Help.
The first operation in the test is Select Device. It specifies a mobile device the test should work with. All
further test operations will refer to this device.
The second operation is Run TestedApp. It is used to launch the tested application (in our case, it is the Orders
application) from a keyword test. TestComplete automatically records this operation when it launches the
application automatically or detects an application launch from the Recording toolbar.
After that, there are operations that simulate your actions with the application. These operations select an item
in the orders list, press the Edit button, change the value of the text field and press the Ok button.
http://support.smartbear.com/
90
For more information on simulating touch events, text input and other user actions from your tests, see
Simulating User Actions Over Android Devices in TestComplete Help.
Finally there is the comparison operation that we added during the test recording:
As you can see, TestComplete automatically organizes the operations into groups that correspond to mobile
devices and processes you worked with. Grouping makes the test structure easier to understand and also
provides some information on the object hierarchy that exists in the application under test.
We recorded user actions on one mobile device and one process. So, we have two group nodes. The device
node groups processes that were launched on the same device. The process node contains all of the actions
that you simulated on the process windows and controls.
smartbear.com
91
You may notice that the names of the tested process and its windows and controls differ from the names that
you can see in the Object Browser panel. For instance, in the Object Browser, the tested process was named
Process("smartbear.example.orders") while in the test it is called Process_example_orders; the Edit button
was called Button("editButton") while in the test it is called Button_Edit, and so on.
There is a logical reason for this: by default, TestComplete automatically generates and uses custom names for
the objects you worked with during the test recording. Generating and assigning custom names is called name
mapping. TestComplete maps the names because the default names may be difficult to understand. It may be
difficult to determine which window or control corresponds to a name. Using mapped names makes the test
easier to understand and more stable. For more information on mapping names, see Name Mapping in
TestComplete Help.
http://support.smartbear.com/
92
To run the recorded test, simply click
TestComplete will start executing test commands. In our case, the test will open the order and change the
customer name from Samuel Clemens to Mark Twain and then verify whether the name has changed.
Note: Dont move the mouse or press any keys during the test execution. Your actions may interfere
with the actions simulated by TestComplete and the test execution may go wrong.
After the test execution is over, TestComplete will restore its windows and display test results. In the next step
we will analyze them.
Some notes about the test run:
During the test execution, TestComplete displays an indicator in the top right corner of the screen:
The indicator displays messages informing you about simulated test actions.
TestComplete executes test commands until the test ends. You can stop the execution at any time by
pressing
Stop on the Test Engine toolbar or in the indicator, or by selecting Test | Stop from
TestCompletes main menu.
Pause. During the pause, you can perform any
You can pause the test execution by clicking
actions needed. For instance, you can explore the test log or check test variables and objects using
TestCompletes Watch List or Locals panel or the Evaluate dialog (see Debugging Tests in
TestComplete Help).
For complete information on running tests in TestComplete, on project settings that affect the runs and on the
test execution, see Running Tests section in TestComplete Help.
smartbear.com
93
Note that TestComplete automatically adds nodes for the last results after the test execution is over. That is, the
results are not displayed when the test is running (you can view intermediate results if you pause the test
execution).
Since we have run only one test so far, we have only one log node in the Project Explorer. By default,
TestComplete automatically opens the contents of this node in the Workspace panel. You can also view the
log at any time. To do this, right-click the desired result in the Project Explorer panel and choose Open from
the context menu.
http://support.smartbear.com/
94
The log window shows the results of one test run at a time. On the left side of the window, there is a tree-like
structure of the tests that were executed during the run; the node of each of these tests can be selected to view
their results. For our example, we have run only one test, so in our case this tree only contains one node. The
nodes icon indicates whether the test passed successfully or failed.
The test log contains error, warning, informative and other types of messages. The icon on the left indicates the
message type. Using the check boxes at the top of the message list you can hide or view messages by type.
For each message, the log also shows the time that each action was performed. You can see it in the Time
column.
TestComplete may post additional text and images along with the message. To view them, simply select the
desired message in the log and look in the Additional Info and Picture panes that are below the message list.
The Picture panel displays the images that show the expected and actual application state before executing the
selected test command. Expected is the image that was captured for the command during test recording,
actual means the image that was captured during test run.) The test log includes a special button that lets you
smartbear.com
95
compare the images and easily see the difference. This simplifies the search for errors that may occur in your
test. For more information, see topics of the Test Visualizer section.
The logs Call Stack pane displays the hierarchy of test calls that led to posting the selected message to the log.
The logs Performance Counters pane displays values of the performance counters monitored during the test
run. The values are shown in the form of graphs.
To view a test operation that posted a message to the log, double-click the desired message in the log.
TestComplete will open the keyword test in the editor and highlight the appropriate operation. For instance, if
you double-click the The button was touched message in the log, TestComplete will highlight the keyword
test operation that performed this action:
For detailed information on the test log panels, on posting messages to the log and on working with the results,
see the About Test Log section in TestComplete Help.
Note: The log that we described is typical for TestComplete keyword tests and scripts. Tests of other
types may form a log of a different structure. For detailed information about these logs, see the
description of the appropriate project item, or simply click within the log page and press F1.
Resolving Errors
Your test may fail. There can be several possible reasons for this. For instance, developers could change the
applications behavior, the recognition attributes of windows and control change and make the test engine fail
http://support.smartbear.com/
96
to find the needed objects, a third-party application may overlap windows of your application and make the test
engine fail to simulate actions on them, and so on.
One of the most typical reasons faced by novice users is the difference in the applications state during the test
creation and playback. To avoid this problem, make sure that the initial conditions of the test run correspond to
those you had when creating the test. For instance, if the tested application had been running before you
recorded the test, it must also be running before you run the test; if the test actions were performed on a
particular screen of the application, you should also open that screen when you run the test, and so on.
If your test ran with errors, examine and fix them to make the test pass.
For information on searching for the cause of errors and resolving typical problems, see Handling Playback
Errors section in TestComplete Help.
Drag the Device Loop operation from the Mobile category of the Operations panel to the Test Area.
Drop the operation at the very beginning of the test (above all other operations). This will add the
operation to the test.
smartbear.com
97
In the ensuing operation parameters dialog, select Iterate Through All Connected Devices and press
Finish.
Delete or disable the Select Device operation from the test. It is no longer needed because the Device
Loop operation iterates through the mobile devices.
Select all test operations that go after the Device Loop operation and click
loop. Now these operations will be executed on each loop iteration.
Save the test by selecting File | Save from TestCompletes main menu.
Prepare and connect another mobile device as described in the Preparing Mobile Device section of
Preliminary Steps.
Now run the resulting test.
http://support.smartbear.com/
98
TestComplete will repeat the test operations several times. Each time the test actions will be performed on a
different mobile device.
The test log contains information about which mobile device was used and results of the test operations
performed on each device.
smartbear.com
99
Requirements
To complete this tutorial, you need the following:
A Windows computer with TestComplete Mobile module and Apple iTunes. iTunes is needed,
because it contains the USB driver that TestComplete uses to connect to iOS devices.
A Mac computer with Xcode, iOS SDK and an iOS development license - to compile the sample
Orders application.
The application should be deployed to the mobile device as described in the further steps of the tutorial.
http://support.smartbear.com/
100
Add your iOS device to the application provisioning profile (for the iOS Developer Program only).
From Xcodes menu, select Windows | Organizer and select Devices to open the device organizer.
Select your device, click the Use for Development or Add to Member Center button.
Select the check box next to your developer program account and click Choose.
smartbear.com
101
Go to Settings | General.
Tap Auto-Lock.
Select Never.
Go to Settings | Wallpapers&Brightness.
This will prevent the device from locking the screen during the test run and reduce battery consumption of the
connected device.
To make sure TestComplete sees the connected device, switch to the Object Browser. You should see the
Device("your_device_name") object under the Mobile object.
On the next step, we will prepare the sample Orders application for testing.
http://support.smartbear.com/
102
Now we need to compile and archive our application into an .ipa file. We need the .ipa file so that
TestComplete can automatically install and launch the application on devices during testing.
If you use Xcode version 6, you also need to copy the re-sign.sh file from the
<TestComplete>\Bin\Extensions\iOS folder. See Instrumenting iOS Applications in Xcode 6 topic in
TestComplete help.
From Xcode's menu, select Product | Archive. Xcode will show the created archive in the Archives
organizer.
In the wizard, select Save for Ad Hoc or Enterprise Distribution and click Next.
smartbear.com
103
Choosing a Provisioning Profile for Your Application section of Preparing iOS Applications topic of
online help.
If you have the iOS Developer Program (not the iOS Developer Enterprise Program), make sure to
select the provisioning profile that includes the test devices - the profile you configured on the
previous step.
After you create the .ipa file, copy it to the TestComplete computer.
Our application and devices are now ready for automated testing. On the next steps, we will create and run a
sample automated test using TestComplete.
http://support.smartbear.com/
104
6. Select the Deploy to the device on start check box and click OK.
7. Make sure that the Autorun check box is selected. If it is selected, TestComplete automatically
launches the Orders tested application on the mobile device when you start test recording. If the check
box is clear, then, to record user actions over the application, you will have to launch the application
manually.
8. On the next page, you can enable or disable Test Visualizer. To do this, check or uncheck the
corresponding check box. Click Next.
9. On the last page, choose the preferable scripting language and click Finish.
TestComplete will create the project and show its files in the Project Explorer.
Now you can install and launch the Orders application on the connected iOS device directly from
TestComplete. To do this, right-click the application in the Process Explorer and select Run from the context
menu.
4. Creating a Test
Creating Tests in TestComplete
TestComplete allows you to create tests in two ways. You can:
Record tests
When you create a test manually, you enter all the needed commands and actions that your test must perform
via appropriate script objects or keyword test commands. This approach is very helpful when you need to
create very powerful and flexible tests or if you have good experience in creating tests.
However, creating tests manually requires a lot of time and does not prevent you from different problems. For
example, while creating a test manually you must know the classes and names of your application's objects you
want to work with. To solve such problems, TestComplete includes a special feature that lets you easily create
tests. You can perform some actions against the tested application once and TestComplete will automatically
smartbear.com
105
recognize these actions and then convert them to script lines or keyword test operations. We call this feature
"recording a test", because you create a test visually and in one sense you record the performed actions to a
script or keyword test. It is a very useful approach and it does not require much experience in creating tests. So,
in this tutorial we will demonstrate how to record tests with TestComplete.
The Mobile Screen window displays the screen of the connected mobile device. This window is used
to record tests against mobile applications. The window is displayed if the Automatically display
Mobile Screen on recording option is enabled.
2. After starting the recording, perform the desired test actions: launch the tested application (if needed),
work with the application as you normally do: select menus, touch buttons and other controls and so
on.
3. After all the test actions are over, stop the recording by selecting
For complete information on test recording, see Recording in TestComplete in TestComplete Help.
Test purpose: The test should check whether the Edit Order page saves the modified data and the
changes are visible in the order list.
Testing steps: Our test should simulate modifying order details and then verify data in the order list.
For simplicity, our test will change only one property of one order.
Checking and logging the test result: If the change made to the order has been saved correctly, it
should be visible in the order list. To check this, our test will compare the data in the list with the
expected value. We will add a special comparison command to the test for this. This command will
http://support.smartbear.com/
106
post comparison results to the test log, so we will see whether verification failed or passed
successfully.
For more information on planning tests with TestComplete, see Planning Tests in TestComplete Help.
Do not switch to the TestComplete help during test recording. The recording engine traces and records
all user actions, so the recorded test will contain the commands that simulate switching.
To see the instructions, you can print them before starting recording. Or, if you have two monitors, you
can move the window of the TestComplete help system to the other monitor.
TestComplete can record user actions on one application only. If you switch to another application, the
recorded test commands will be lost.
So, during recording, work with your tested application only. Do not press the Home button on the iOS
device, do not launch other tested applications, do not minimize your tested application and do not
switch to other applications on your device in some other way.
Now lets record a keyword test for the sample iOS Orders application.
1. Before recording a test, open the Mobile Screen window. TestComplete records only those actions
over mobile applications that you perform in this window.
smartbear.com
107
TestComplete will display the Recording toolbar on screen. If the Interactive Help panel is visible,
TestComplete will also show information about the recording process in it.
By default, the Recording toolbar is collapsed:
Click the
arrow button to expand the Recording toolbar and view all its buttons:
4. After you start recording, TestComplete will automatically deploy the Orders application to the mobile
device and start this application. This will happen because you enabled the applications Deploy to the
device on start and Autorun options while creating the test project on the previous step.
If the Autorun option is disabled, you will have to launch the application manually. To do this, select
the Run Tested Application command from the Recording toolbar:
http://support.smartbear.com/
108
You can also launch the application from the Run Apps drop-down menu on the Mobile Screen
windows toolbar.
TestComplete records the application start using a special application launch test command. You will
see this command later when analyzing the recorded test.
5. Wait until the iOS Orders application installs and starts on the mobile device. The Mobile Screen
window will display the initial window of the application:
If the Interactive Help panel is visible, resize or move it so that it does not overlap the Mobile Screen
window. Your actions on this panel are not recorded.
6. In the Mobile Screen window, press the Edit button. This will switch the Orders application to the edit
mode.
smartbear.com
109
7. Click the second order in the list made by Samuel Clemens. This will display the Edit Order panel:
http://support.smartbear.com/
110
In the CUSTOMER INFO section, clear the Samuel Clemens text, type Mark Twain and press Enter.
Use your desktop keyboard to input text in the Mobile Screen window.
9. OK, now press the Save button in the Edit Order panel. This will invoke the confirmation dialog:
smartbear.com
111
13. Now lets insert a comparison command into our test. It will verify that the applications customer list
displays the modified name - Mark Twain.
We call comparison commands checkpoints. TestComplete offers various types of checkpoints that
can be used to verify different types of data (see Checkpoints in TestComplete Help). One of the most
frequently used checkpoints is the Property checkpoint. It is used to check data of application
controls. We will use this checkpoint in our tutorial.
Select
Create Property Checkpoint from the Checkpoint drop-down list of the Recording
toolbar:
http://support.smartbear.com/
112
This will invoke the Property Checkpoint wizard. It will guide you through the process of
checkpoint creation.
Wait until the wizard minimizes and then drag the icon to the orders list of the Orders application.
While you are dragging, TestComplete will highlight the controls and windows under the mouse
cursor with a red frame.
Release the mouse button when the target glyph is over the orders list and when the entire list is
highlighted with the red frame:
smartbear.com
113
After you release the mouse button, TestComplete will restore the wizard and display the name of
the selected object in the Object box and the image of the object below it:
http://support.smartbear.com/
114
Click Next to continue.
The next page of the wizard displays a list of the selected objects properties. This list includes the
properties provided by TestComplete and the properties defined by the tested application. To view
all the available properties, click the View more members (Advanced View) link.
TestComplete appends three groups of properties to the selected object: one group includes
properties common for all tested windows and controls. You can see them under the Standard
node. Another group includes properties that are specific to mobile controls. You can see these
properties under the Extended node. Finally, all native properties of the corresponding control are
displayed under the iOS node.
To verify the data, we will use the wItem property. It provides access to the text shown in the
specified item of the selected table view.
Find the wItem property in the list. Click the Params button and enter 1 in the Index field. Click
OK and then Next to continue.
On the next page of the wizard, you can see the name of the property whose value will be verified,
the comparison condition and the baseline data, which is in the Value box:
smartbear.com
115
Click Finish to complete the checkpoint creation. TestComplete will append the checkpoint
command to the recorded test.
14. Press Stop on the Recording toolbar to stop recording. TestComplete will process the recorded test
commands and save them to the keyword test.
http://support.smartbear.com/
116
The recorded test is similar to the test shown in the image above. Your actual test may differ from this one. For
example, it may contain some unnecessary touch actions.
The test contains the commands that correspond to the actions you performed on the Orders application during
test recording. We call these test commands operations.
Below the commands there is the Test Visualizer panel that displays images which TestComplete
captured for operations during test recording:
These images illustrate the recorded operations and help you better understand which action the
operation performs. TestComplete captures images only for those operations that correspond to user
actions (touching, dragging, typing text and so on).
When you choose an operation in the editor, Test Visualizer automatically highlights the appropriate
image so you can easily explore the application state before the operation is executed. For more
information on working with images, see the topics in the Test Visualizer section in TestComplete
documentation.
smartbear.com
117
The first operation in the test is Select Device. It specifies the mobile device the test should work with. The
other test operations refer to this device.
The second operation is Run TestedApp. It is used to launch the tested application (in our case, it is the Orders
application) from a keyword test. TestComplete automatically records this operation when it launches the
application automatically or when it detects that the application has been launched from the Recording
toolbar.
Then there are the operations that simulate your actions with the application. These operations press the Edit
button, select an item in the orders list, change the value of the text field, save the changes and press the Done
button.
http://support.smartbear.com/
118
For more information on simulating touch events, text input and other user actions from your tests, see
Simulating User Actions on iOS Applications and Working With iOS Controls in TestComplete Help.
Finally, there is the comparison operation that you added during test recording:
As you can see, TestComplete automatically organizes the operations into groups that correspond to the mobile
devices and processes you worked with. Grouping makes the test structure easier to understand and also
provides some information on the object hierarchy that exists in the application under test.
We've recorded user actions on one mobile device and one process. So, we have two group nodes. The
device node groups processes that were launched on the same device. The process node contains all of the
actions that you simulated on the process windows and controls.
smartbear.com
119
You may notice that the names of the tested process and its windows and controls differ from the names that
you can see in the Object Browser panel. For instance, in the Object Browser, the tested process was named
Process("Orders") while in the test it is called ProcessOrders; the navigation bar was called NavigationBar(1)
while in the test it is called navigationbar1, and so on.
There is a logical reason for this: by default, TestComplete automatically generates and uses custom names for
the objects you worked with during test recording. Generating and assigning custom names is called name
mapping. TestComplete maps the names because the default names may be difficult to understand. It may be
difficult to determine which window or control corresponds to a name. Using mapped names makes the test
easier to understand and more stable. For more information on mapping names, see Name Mapping section in
TestComplete Help.
http://support.smartbear.com/
120
TestComplete will launch the Orders application on the device and perform the test actions on it: open Samuel
Clemenss order and change the customer name to Mark Twain.
Test Results
After the test finishes, TestComplete shows the test log. You can look at it to see if the test has passed. We will
tell you more about the test results in the next step of this tutorial.
Important: Do not touch the device's screen during the test run to avoid interference with the
test actions.
During the test execution, TestComplete displays an indicator in the top right corner of the screen:
The indicator displays messages informing you about simulated test actions.
smartbear.com
121
For complete information on running tests in TestComplete, on project settings that affect the runs and on the
test execution, see Running Tests section in TestComplete Help.
The log contains messages of different types: actions, events, checkpoints and so on. You can filter the
messages using the toolbar above the message list. If you double-click a log message, TestComplete will
navigate to the test operation that posted this message. This is useful when you need to know which operation
caused an error.
The Picture panel contains images that show the expected and the actual application states before the selected
test command is executed (Expected is the image that was captured for the command during test recording,
and Actual is the image that was captured during the test run.) The Actual Image toolbar has a special button
that lets you highlight the difference between the images (if any). The images help you understand what
happened in the application during the run, view the differences and find errors faster. For more information on
capturing images, see the topics of the Test Visualizer section in TestComplete help.
There are two more panes at the bottom of the log:
Call Stack is useful when debugging tests that call each other. It shows the sequence of test calls that
led to the current operation or error.
http://support.smartbear.com/
122
Performance Counters shows local or remote computer metrics (CPU load, memory usage and so
on) measured during the test run. We do not use performance counters in our tutorial, but if you have a
client-server iOS application, you can set up performance counters to track your server metrics.
All logs are kept under Project Suite Logs | ProjectName Logs in the Project Explorer, so that you can review
the previous logs.
Sometimes, tests fail. This can happen if the object properties in the application were changed and no longer
match the identification properties specified in Name Mapping. You need to troubleshoot the failed tests to
find and fix the cause of the errors. For more information about finding and fixing errors, see Handling
Playback Errors and Debugging Tests sections in TestComplete Help.
Different application layouts on tablets and smartphones. An applications user interface may vary
depending on whether it runs on devices with a small screen (iPhones or iPods) or on devices that have
a larger screen (iPads). On small screens, the application may divide its UI elements into several
layouts (panels, pages, views, tabs and so on). So, you may need to perform different actions to access
the same control on a tablet and on a smartphone. As a result, a test created on an iPad will work on
other iPads, but may fail on iPhones or iPod touch devices, and vice versa - a test created on an iPhone
will work on other iPhones and iPod touch devices, but may fail on iPad devices.
There are several ways to handle this situation. The easiest way is to create two variants of your test one for tablets, and one for smartphones. A more complex solution is to adapt the test for both types of
smartbear.com
123
devices. This may require creation of conditional test structures and probably adjusting the criteria of
object recognition.
Different object hierarchy on different versions of iOS. Different versions of iOS may have a
different object hierarchy. So, a test may not find the needed object on another version of iOS. To
resolve this issue, you may need to correct the identification properties of such mismatching objects in
the Name Mapping project item (the object repository).
The Orders application, which we use in this tutorial, also changes its layout depending on whether it is
running on a tablet or on a smartphone. To make the tutorial simple, we will not adapt the test for both types of
devices, so please use devices of the same type (either iPhones or iPads) when running your test.
Also, the Orders application has a bit different object hierarchy when running on iOS 6 and on later iOS
versions (iOS 7-8). The test you have created addresses the textfield0 object whose full name is different on
iOS 6 and on later versions. This object corresponds to the Customer name editor of the Edit Order panel. The
full mapped name of this object is different on iOS 6 and on iOS 7-8:
NameMapping.Mobile.Device.processOrders.window0.tableview0.tablevie
wcell6.textfield0 (on iOS 6)
NameMapping.Mobile.Device.processOrders.window0.tableview0.tablevie
wcell6.scrollview0.textfield0 (on iOS 7-8).
First, you need to ensure that this object can be found by TestComplete. Switch to the Mobile Screen
window and do the following:
Select any order in the list. This will display the Edit Order panel that contains the Customer
name editor.
Double-click the NameMapping item in the Project Explorer to open the Name Mapping editor. Here
you can view and edit the identification properties of mapped objects.
(On iOS 7-8) Drag the textfield0 object to make it an immediate child of the tableviewcell6
object.
Enable the Extended Find check box for the textfield0 object.
http://support.smartbear.com/
124
(On iOS 7-8) In the Aliases tree, drag the textfield0 objects alias to the tableviewcell6
alias (like you did in the Mapped Objects tree).
(On iOS 7-8) Delete the unneeded scrollview0 object from the Mapped Objects and Aliases trees.
To delete an object, right-click it and select Delete from the context menu.
(On iOS 7-8) Now, you need to update the object name in the keyword test.
Press Finish.
In the Mobile Screen window, revert the Orders application to its initial state. Discard the changes
made to the order (if any), close the Edit Order panel and press Done.
Add the Device Loop operation from the Mobile category. Place it in the very beginning of the test.
smartbear.com
125
In the ensuing operation parameters dialog, select Iterate Through All Connected Devices and press
Finish.
Delete or disable the Select Device operation from the test. It is no longer needed because the Device
Loop operation iterates through the mobile devices.
Select all test operations that go after the Device Loop operation and click
loop. Now these operations will be executed on each loop iteration.
Save the test by selecting File | Save from TestCompletes main menu.
Prepare and connect another mobile device as described in the Preparing iOS Device step. The type of the
devices you use must be the same as the type of the devices you used when creating the test: either iPhones or
iPads.
2014 SmartBear Software
http://support.smartbear.com/
126
smartbear.com
Where to Go Next
127
Where to Go Next
This concludes the Getting Started tutorial. We hope it helped you to get acquainted with TestComplete. Now
you can learn how to create tests for other types of applications, or you can learn about more advanced features
and even start creating your own tests. To get more information about TestComplete and its features, please
refer to TestComplete Help. Below are some help topics that may interest you:
Common
Recording in TestComplete
This section contains information on recording tests in TestComplete.
Checkpoints
This section describes various checkpoint types offered by the test engine and explains how to create
checkpoints during test recording or test design.
Running Tests
This section contains information on how to run tests, how to organize batch runs (run a group of
tests), how to schedule test runs and so on.
Test Log
Explains how TestComplete logs test results and describes the test log panels. This section also
describes how to post messages, images and files to the log.
Handling Playback Errors
Explains how to handle errors that occur during the test run.
Teamwork and Integration Into QA Process
Explains how to share TestComplete projects with teammates and how to integrate your TestComplete
tests into the build, development and quality assurance processes adopted in your organization.
http://support.smartbear.com/
Where to Go Next
128
This section contains topics that explain how to perform specific actions over test objects and retrieve
data from them.
Enhancing Tests
Provides information about various TestComplete features that help you enhance your tests (how to
handle events, how to work with ActiveX objects, files and databases, and so on).
smartbear.com
129
http://support.smartbear.com/
Index
130
Index
A
B
Black-box applications ....................................... 10
C
Checkpoints ............................................ 11, 27, 82
Creating ..................................................... 27, 82
Creating
Desktop Projects.............................................. 19
Web Projects ................................................... 47
Creating tests
Desktop ........................................................... 21
Mobile (Android) .................................... 76, 104
Web ................................................................. 49
F
Functional testing .................................................5
I
iOS applications testing ......................................99
K
Keyword tests .......................................................5
L
Log
Desktop............................................................41
Jump to source ..................................... 43, 66, 95
Web .................................................................64
M
Mapping object names .................................. 38, 62
Mobile applications testing ........................... 70, 99
Mobile Screen .....................................................80
N
Name mapping .............................................. 38, 62
NameMapping ..................................................120
Correcting identification properties...............120
Naming objects .....................................................9
O
Object Browser panel ...........................................8
Object model.........................................................9
Object naming.......................................................9
Open Applications ..............................................11
P
Panels ....................................................................7
Preparing
Android application .........................................74
smartbear.com
Index
131
Scripts ................................................................... 5
Simulating user actions................................. 37, 61
Stores .................................................................. 11
Support and resources....................................... 127
UI testing ..............................................................5
User interface overview ........................................7
http://support.smartbear.com/