Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
&'(
!)
+,,$&-&./(". +01."21 !#(".2/-
SOASTA TouchTest for Appcelerator Android Tutorial
2014, SOASTA, Inc. All rights reserved.
The names of actual companies and products mentioned herein may be the trademarks of
their respective companies.
This document is for informational purposes only. SOASTA makes no warranties, express or
implied, as to the information contained within this document
Table of Contents
................................................................................................. Why Mobile App Testing? 1
..................................................................................................................... CloudTest Basics 1
............................................................................................... What Does Touch Test Record? 2
................................................................. Adding TouchTest to an Appcelerator App 3
................................................................................... Appcelerator Prerequisites for Android 3
............................................................................................................ TouchTest Prerequisites 5
.................................................................... Importing and Preparing the Project for Android 6
................................................................................ Using the MakeAppTouchTestable Utility 9
......................................................................................... Static vs. Dynamic Instrumentation 9
......................................................... Using the Optional titaniumsdk Flag (Dynamic/Static) 12
............................................................ Inspecting Changes to the Titanium Project (Static) 12
............................................................................................... Deploy the TouchTestable App 14
................................................................................ Install the TouchTest Agent on a Device 15
.................................... Approving a Mobile Device (Mobile Admin or CloudTest Lite user) 18
................................................................................. Associating Mobile Apps with a Device 20
............................................................................... Recording a TouchTest Scenario 21
.......................................................... Create a Simple TouchTest Clip using KitchenSink 22
................................................... Adding an Interval Delay between Each Action (Optional) 25
.................................................................................................... Create a Composition 27
............................................................................................................. Playing a Composition 29
........................................................................................................ Navigating Result Details 29
............................................................................ Identifying and Analyzing Common Errors 31
........................................................................................ Network or Communication Errors 31
.................................................................................................. App Action and Other Errors 31
.................................................................................................... Advanced Clip Editing 36
................................................................................................ Inspecting App Action Details 37
..................................................................................... App Action Elements and Properties 37
......................................................................................................... Adding a Text Validation 39
................................................................................................................... Adding an Output 40
i
Any iOS 5.0 or later device including iPhone, iPad, iPod Touch, as well as
Simulators. There is no need to jailbreak the Android Device and the device
can be untethered.
Beta Support is provided for recording user actions on:
provides an additional set of Waits, which allow the tester to gain control of the pace
within a test.
Titanium Studio is installed with the Android SDK (the minimum supported
Android version is 2.3.3. (Gingerbread).
TIP: If you're unsure of the installed Android SDK(s) on your system, use
the android-sdks/tools/android command to list them. For
example, from your android-sdks folder (or if it's in your path) use:
android list target
The android command with the list target ag gets a list of the installed Android
SDK(s) on your system.
Then, ensure that your project's tiapp.xml is using the SDK version id number that
you intend for it to use and that the SDK version is among those installed.
4
The developer should note the Titanium Studio SDK path before proceeding
with the steps under "Using the MakeAppTouchTestable Utility" below.
This is either ~/Library/Application Support/Titanium/mobilesdk/osx or ~/
Library/Application Support/Titanium/mobilesdk/osx with the specic SDK
folder appended at the end.
The developer should also note the Android SDK location for use with the
MATT androidsdk ag where required (for signing, etc.).
5
TouchTest Prerequisites
The following prerequisites are required to make an Android project TouchTestable:
You will need a mobile app to follow the tutorial, or clone the example
Appcelerator KitchenSink project using GitHub.
--Or
You can also download the KitchenSink project archive and unzip it into your
repository folder.
Once downloaded, unarchive the projects components prior to running the utility.
The unarchived project folders are shown below.
This archive contains the following:
Download the KitchenSink project archive into your working folder and unzip
it.
<KitchenSink APK> is the path to the KitchenSink (or other) APK le. As
we noted above, our example path under Mac OS X was:
~/Documents/Demo/KitchenSink
Optionally, you can manually specify an additional launchurl ag, being sure
to specify the correct URL syntax (shown below).
This ag is used in the CloudTest repository to represent your mobile app and
in the compiled app. For Eclipse projects, this setting originates in the
AndroidManifest.xml. Whether you create the TouchTestable Android app using
the project or apk MATT parameterthis launchurl must match for testing to
succeed.
For example,
-launchURL KitchenSink://key1=value1&key2=value2&key3=value3
MakeAppTouchTestable will congure your project, and create a new Mobile App
object in the CloudTest server repository. The Mobile App object created will have the
auto-created URL Scheme in its Launch URL eld. The following text output appears
in Terminal:
Mobile App Object "KitchenSink" representing your Application "KitchenSink"
has been created in CloudTest Repository.
11
The Mobile App object created will have the auto-created scheme found in tiapp.xml
unless otherwise specied.
You will see a message similar to the following:
Will create the launch url: touchtest-e4eedd67-4ea9-495a-
be57-2d34eaafc510://
Using Additional MATT APK Flags
You can use MATT to add keystore, keypass, and storepass ags to sign the
dynamically instrumented APK le.
Use the following MATT optional APK parameters
-keystore <keystorepath> - Path of the keystore to be used to sign the APK le..
<Android project file> is the path to the root folder of your project
Here is a complete example:
java -jar MakeAppTouchTestable.jar -project ~/Documents/Demo/
KitchenSink
-url http://10.0.1.6/concerto -username SOASTA_DOC -password secret
Optionally, add the launchurl ag, being sure to specify the correct URL
syntax. This setting originates in the AndroidManifest.xml le in Eclipse
projects and tiapp.xml in Titanium projects. The launch URL in the compiled
app and in the CloudTest, Mobile App, launch URL eld must match for testing
to occur.
For example,
12
-launchurl KitchenSink://key1=value1&key2=value2&key3=value3
MakeAppTouchTestable will congure your project, and create a new Mobile App
object in the CloudTest server repository. The Mobile App object created will have the
auto-created URL Scheme in its Launch URL eld. The following text output appears
in Terminal:
Mobile App Object "KitchenSink" representing your Application "KitchenSink"
has been created in CloudTest Repository.
The Mobile App object created will have the auto-created scheme found in
AndroidManifest.xml unless otherwise specied. You will see a message similar to
the following:
Will create the launch url: touchtest-e4eedd67-4ea9-495a-
be57-2d34eaafc510://
Using the Optional titaniumsdk Flag (Dynamic/Static)
In most cases, the MakeAppTouchTestable utility will correctly detect the location of
the Titanium SDK on Android. However, for those exceptions that may occursuch
as for non-standard locationsthe -titaniumsdk ag is provided. This ag is
applicable only to Android projects.
To use this ag, specify the path of the Titanium SDK. For example:
/Library/Application Support/Titanium/mobilesdk/osx/
or
~/Library/Application Support/Titanium/mobilesdk/osx/
with the avor or SDK appended at the end of the path. For example:
/Library/Application Support/Titanium/mobilesdk/osx/2.1.3.GA
Putting it all together we get:
-titaniumsdk /Library/Application Support/Titanium/mobilesdk/osx/2.1.3.GA2
Inspecting Changes to the Titanium Project (Static)
The MakeAppTouchTestable utility changes your Titanium project in the following
ways:
Click Record within the Clip Editor and then choose Mobile App Recording
and specify the Device Agent and the mobile app whose actions you want to
record.
These and the following additional conguration steps are described in the remainder
of this tutorial.
Tap Button
On the Button screen, tap the button that says "Click Me" and then tap it three
more times; once each for "I am enabled", "I am red", and nally for "White
text."
When the button says "I am disabled" for the second time (and this time
doesn't quickly change its state to "I am enabled"), then tap the Android
device's Back icon (bottom left)
25
For each app action you perform, the Clip Editor adds an app action to the clip.
There were eight actions recorded in our clip.
Click the Record button again to stop the recording (the "red" Record button
above is still in Record mode).
Switch the Clip Editor to List view using the Icon/List button on the Clip Editor
toolbar in order to see more inline details about the app actions that were
added.
Note: App Action4 through App Action7 above are actions that originated in
the button clicks during our recording session.
Click Save on the Clip Editor toolbar. In our example, we gave the clip the
name, Demo Clip for KitchenSink-Android.
TIP: It is possible to proceed to create and play a composition at any point
after Recording is completed.
Adding an Interval Delay between Each Action (Optional)
In the following steps, we will add an interval delay to the test clip. This type of delay
will stretch out the time between all the recorded app actions.
Imposing delays, either using the Interval Delay setting or by inserting Delay clip
elements, can make the test more viewable during test playback (when viewing the
test as it plays is most desirable).
1. Click the Properties tab in the minimized sub-panel and then select the Clip tab
at the top of the pane (the Clip tab may already be visible if properties are
already open from the prior exercise).
26
2. In the Property Type list, click Clip Properties.
3. In the Clip Properties panel on the right, enter an Interval Delay in the given
eld. For example, 2000 ms. Entering 2000 adds a two second gap between
each app action in the given test clip.
4. Click Save on the Clip Editor toolbar.
TIP: It is possible to proceed to Create a Composition at any point after
Recording is completed.
27
Create a Composition
With your test clip open in the Clip Editor, you are ready to create and play a new test
composition using this test clip.
1. To create a new composition from your test clip, click the Open in Test
Composition drop-down in the upper-right corner of the Clip Editor toolbar
and choose from among:
General, Repeat, and Custom Properties (for the action only; not for the entire
clip) tabs appear on the right. Note that Error Handling here is set to Errors
should fail the parent by default.
Other settings, including Waits, Inputs, Outputs, Validations, and Property Sets
can be set by clicking that node in the tree and then performing the desired
action on the right.
1.In the Selected: AppAction2 tab (or for any selected app action), familiarize
yourself with the available elements and properties.
Outputs
Outputs specify what is to be shown in the Result Viewer for a given
Action. Typical outputs include captureScreenshot, outputElementText,
and outputInnerHTML. A single Action can have an unlimited number of
outputs.
Validations
Validations verify some content or event occurred as expected and have a
39
corresponding Failure Action. App Action validations can range from
simple true/false conditions to more complex conditions. A single App
Action can have an unlimited number of validations. Any validation failures
will be exposed in the Results Dashboard.
Property Sets
Property Sets give you the ability to take text or data from the app you are
testing and store it in a custom property for use in a subsequent action or
message.
SOASTA CloudTest includes three property sets, all of which have
relevance for rening and editing a selected App Action.
o
Custom Properties
Custom Properties are user-dened properties that are available to all
clip elements, including Actions. Custom properties can be thought of
as backdoors that allow access to portions of the object model more
easily.
o
System Properties
System Properties are available to all clip elements, including Actions.
SOASTA CloudTest denes system properties. For example, a test clip
has system properties such as name, repeat timing, label, and more.
o
Global Properties
Global properties are dened within the Central > Global Properties List
and are global within the entire SOASTA CloudTest environmentand
can be used across compositions.
Adding a Text Validation
Next, we will add a validation on AppAction2 (or the app action whose operation is
type and whose locator is placeholder=Username in the clip you recorded from the
SOASTA Demo app). The response to this and other actions will contain information
worth validating in many cases. The remaining steps demonstrate how to do simple
validation in CloudTest.
1. Note the content of the given app action. For example in AppAction2 of our
sample clip, Locator had the value text=Slider[1].
2. If its not already open in the lower panel, open it now by double-clicking.
3. Click Validations in the list and then click the green Plus sign in the
Validations panel on the right.
An Action: type form is added to the right panel.
40
4. In the Command list, a list of commands is presented.
Click the drop-down and select verifyElementText. This Command veries
that the specied text is in the rendered eld.
5. In the Locator eld, enter the eld name shown above. For example,
text=Slider[1].
6. In the Match eld, accept Exact Match and enter the username. For example,
soastadoc.
7. Leave the default Fail the Clip set in the Failure action eld.
8. Click Save on the Clip Editor toolbar.
Adding an Output
In the following steps, we will add an output to an App Action in the test clip we
created above. This output will capture a screenshot of the test clip element as it is
executed during runtime and this screenshot will be integrated into the test results.
1. Once again, select the Action to display its properties in the sub-pane
below.
41
1. Click Outputs in the list on the left, and then in the Action: type eld just to
the right, click the green Plus sign again. A new output is added to the
Outputs list and the details are shown in the Element Info eld.
2. Click the Command list drop-down, and then scroll to the top of the list and
select captureScreenshot.
3. Check Only if there is an error if the output is desired only in the event this
AppAction produces an error. Otherwise, leave it unchecked. For our example,
we will leave it unchecked to ensure we get an output in every eventuality.
4. Click Save on the Clip Editor toolbar.
5. Return to the Composition Editor tab once again and click Play a second time.
In the following section, well inspect results for the validations and output that
were set on AppAction2 above.
42
Analyzing Results
Result Details has several methods for navigating through the test results. Click the
checkboxes in the cover ow to quickly display messages (or Actions) only (within a
single band, track, test clip, or chain.
In the best-case scenario, the parameters added in Advanced Clip Editing work
without a hitch. We can easily verify the status of our parameters in Result Details.
Expand the Navigation Tree until AppAction2 is in display and then select it
as shown below.
1. To inspect the latest result for the test, open the result in the Composition
Editor > Results tab (if it is not already open.
2. Select the clip element that had the validation. For example, AppAction2 (as
shown above).
3. Inspect the information on the Summary tab for the selection. In the result
above, both the validations on AppAction2 passed in the result shown.
43
4. Scroll down, if necessary, to view the captureScreenshot output dened for
AppAction2 in our example.
Note: Since we didnt check Only if there is an error in the Output form so a
shot of the success is included in this result for the given app action.
5. Click the Events list tab for the given selection to view action-related events,
including validations. Click the Details arrow to inspect any events details.
SOASTA, Inc.
444 Castro St.
Mountain View, CA 94041
866.344.8766
http://www.soasta.com