Knowledge Base - Documentation

Published on Documentation (http://127.0.0.1)
Home > Knowledge Base
Knowledge Base
Knowledge Base
In this knowledge base, you can find articles covering a wide variety of topics about TestPlant products. These articles give advice geared towards specific testing practices.
PDF Version
If you want to access the documentation offline, you can download a PDF version of this manual from the following link:
Click Here for PDF Documentation [1]
Table of Contents
Testing Android Smartwatches [2]
Testing Set-Top Boxes with a Slingbox [3]
Sending Test Results via Email [4]
Accessing a Data Cell by Name [5]
Using Ask and Answer [6]
Pseudo GPS Locations [7]
Synchronizing Script Execution [8]
Creating Encrypted Connections with Stunnel [9]
Typing Unicode Characters with eggPlant Functional [10]
Typing on Soft Keyboards [11]
Connecting to Windows RT Devices [12]
Framework and Modularity are Key [13]
Keyword Driven Testing with eggPlant Functional [14]
Localize Results with a Post-Run Script [15]
ADB Command Support [16]
Keep your SUT Awake [17]
Switching Systems During a Test [18]
Scripting Through a SUT Restart [19]
Successful Image Searches Across Mobile Devices [20]
Dynamic Data Generation [21]
Dynamic Search Rectangles [22]
Single Machine Testing [23]
Data Driven Testing [24]
Text Images and Web Browsers [25]
Managing Windows 7 Magnification Settings [26]
Help and Additional Information
Manuals
You can access all of the following manuals online through the TestPlant Documentation website [27]. You can also access documentation within individual products by going to
Help > Documentation.
Getting Started [28] provides instructions for a basic eggPlant Functional set up to get you started using this testing tool and familiarize you with its functionality.
Using eggPlant Functional [29] is a collection of articles that delve into the eggPlant Functional workflow and explain a variety of important tasks and concepts such as
how to organize your testing process and how to use eggDrive to integrate scripts from other testing tools.
eggPlant Functional Reference [30] describes the eggPlant Functional interface and scripting processes, and the SenseTalk commands, functions, and global properties
that are unique to eggPlant Functional.
SenseTalk Reference [31] is a comprehensive guide to the SenseTalk scripting language used with eggPlant Functional. This manual discusses all aspects of the SenseTalk
language that are used for general scripting purposes. Commands and functions that are unique to eggPlant Functional are also described here.
The eggPlant Performance [32] manual describes how to set up, run tests, and view results with eggPlant Performance, a load and performance testing tool.
The eggPlant Manager [33] manual provides instructions for a basic set up of eggPlant Manager, a test management system. Learn how to schedule and execute tests and
view results.
The eggCloud [34] manual describes how to deploy and administer eggCloud, a test-reservation system. You'll also learn how to make reservations and how to connect
through eggCloud.
The eggMan [35] reference helps you set up and get started using this free tool for manual testing.
The eggBox [36] manual describes this appliance, which comes with a range of pre-installed TestPlant tools and related applications, and shows how you can use it to
easily set up and run a test lab.
The eggPlant Network [37] reference describes the eggPlant Network appliance and how to use it to emulate network conditions when testing with eggPlant Functional
and eggPlant Performance.
Connecting to SUTs [38] is a reference for everything you need to know about how to connect to and test against mobile devices with eggPlant Functional using either
eggOn or iOS Gateway.
The Knowledge Base [39] is a collection of articles from different contributors that describe a variety of techniques and approaches to using eggPlant Functional, as well as
best practices and use-case scenarios.
Further Resources
The Examples section [40] of the TestPlant documentation provides a variety of example scripts using SenseTalk to run eggPlant Functional tests, which you can adapt to
fit your testing needs.
The FAQ section [41] gathers common problems and solutions for TestPlant products.
Online eggPlant Functional Tutorials: [42] This series of four interactive tutorials introduces the scripting environment and some frequently used commands and functions.
eggPlant Functional User Forum: [43] Use this forum to ask questions of other eggPlant Functional users, help your peers, and share ideas and approaches for using the
product.
eggPlant Functional Examples Forum: [44] This forum is a collection of eggPlant Functional scripts written in SenseTalk that address a variety of scripting problems.
Testing Android Smartwatches
Using eggPlant Functional to test Android Smartwatches
It's always been easy to use eggPlant Functional to create connections to systems under test (SUTs). The different types of devices you can test continues to grow. You can
now include Android smartwatches among your SUTs. At TestPlant, we recently tested the Samsung Gear watch, running the Android Wear operating system (OS).
Because Android Wear is based on the Android OS, the process for connecting to an Android Wear smartwatch is the same as connecting to any Android device:
1. Enable debugging on the smartwatch
2. Attach the smartwatch by USB to your phone or computer
3. Add it to the eggPlant Functional connection list
This connection process is even easier since the release of eggPlant Functional 15.11, which automatically copies and starts a VNC server on Android devices that do not
1
have a VNC server installed.
This video shows how to create an eggPlant Functional connection and optimize a script for a Samsung Gear smartwatch. The steps that follow describe these tasks in detail.
Step by Step: Configure a Samsung Gear Android Smartwatch Connection
Following are the steps to configure a Samsung Gear (Android Wear) smartwatch connection:
1. Pair the watch with a phone running Android Wear. This process requires Android 4.3 or later. We suggest you also allow the watch to install any system updates. There
was a noticeable increase in performance after the system was updated from the factory settings.
2. For Mac users, you do not need to install any device-specific USB drivers. Continue to step 3. If you are using a PC, you must install theSamsung Android USB Driver
for Windows and then follow these steps:
Samsung USB Driver for Windows
a. Connect the watch to the PC by USB cable using the watch charging attachment. Gear Live should appear as an Other Device in the Windows device manager.
b. Right click and select Update Driver Software.
c. Select Browse my computer for Driver software.
d. Select Let me pick from a list of device drivers on my computer .
e. Then select ADB Interface.
f. Select SAMSUNG Android ADB Interface .
3. Enable USB Debugging on the smartwatch:
a. Press the side button until Settings appears.
b. Swipe down to About and tap it.
c. Tap on the build number until developer options are enabled.
d. Select Developer Options and enable USB Debugging. The Allow Wear Debugging confirmation dialog displays on the paired phone.
e. Select Always allow from this computer and confirm debugging. This might only appear when you reconnect the USB.
f. From the Options, select Stay awake when charging.
4. You can now add the watch to the eggPlant Connection List as below. For more information about creating connections to Android devices, see Connecting to Android
SUTs [45].
New eggPlant Functional connection for Samsung Gear Android Wear Watch
eggPlant VNC Server Installs Automatically on Android Devices
When you connect to the smartwatch, eggPlant Functional automatically installs an eggPlant VNC server if one is not installed. You might see the notification "EggSensor
Installed." This feature works for any Android device when a VNC server is not installed.
EggSensor Installed Notification
When you make a connection from eggPlant Functional, you can work with the smartwatch in the same way you do with any other mobile device, including using all the
features of eggPlant Functional.
2
Gear Live (Android SmartWatch) SUT Window
Optimize a script for a smartwatch
Because a smartwatch is a relatively low-powered device, you might need to adjust settings for execution rates so that the script actions are not performed too fast for the
device.
Example:
set the RemoteWorkInterval to 1.2 //increase the time allowed for remote system processing
Sound Testing with eggPlant Tools
Sound Testing with eggPlant Tools
Many users of TestPlant's testing tools are interested in sound testing as part of their overall automated or manual testing requirements. The eggPlant range of tools lets you
integrate sound quality analysis or sound streaming software into the eggPlant environment to facilitate sound testing of systems under test (SUTs).
Manual Sound Testing of Remote Systems
For testers using eggPlant tools such as eggMan, eggCloud, and eggBox for manual testing, the test devices or systems are generally located remotely or in a confined
location where it isn't possible for the tester to listen directly to the audio produced by system speakers. One way to get around this problem is to use a third-party streaming
application.
Nicecast (Rogue Amoeba Software) [46] is an application available for Mac OS X that you can use to broadcast streaming audio from a connected SUT. You tether the SUT via
an audio cable to the Mac (or eggBox) where Nicecast is running. Nicecast then provides the mechanism for remote users to access the audio broadcast from the SUT over
the network.
Network configuration with Nicecast running on an eggBox for audio testing
Automated or Manual Sound Quality Testing
Whether a SUT is physically accessible or not, testers are often interested in testing sound produced by an application or SUT. In automated testing, eggPlant Functional can
be used to control sound quality software from companies such as Prism Sound, MathWorks, or RightMark Audio Analyzer (RMAA), just as it can control any application under
test. A single eggPlant Functional script can trigger a sound on a SUT, then connect to a system running the sound testing software to visually validate sound quality or other
characteristics in an automated fashion.
The SUT that produces the audio can be connected either directly to the system running the sound testing software or to an intermediate piece of audio capture hardware,
such as Prism Sound or M-Audio products, as shown in the following diagram:
3
Network configuration for audio sound quality testing
Additional Information
Nicecast, Rogue Amoeba Software [46]
Prism Sound [47]
Digital Signal Processing (DSP), MathWorks
RMAA [49]
M-Audio [50]
[48]
eggDrive vs. Command Line Execution
eggDrive vs. Command Line Execution
There are a few different ways to execute SenseTalk commands and eggPlant Functional scripts from other testing tools and scripts written in languages other than
SenseTalk. This article discusses the intended use-cases for eggDrive [51] and running from the command line [52] with eggPlant Functional to help you decide which approach
is best for your team.
eggDrive
eggDrive is an API that enables you to invoke eggPlant functionality as a service. For example, you can use eggDrive to run eggPlant Functional commands in conjunction
with Vector CANoe in automotive, from within an in-house Python test framework, or from a keyword driven test framework [14].
eggDrive is not designed to be a convenient way to run eggPlant Functional. The simpler command line interface is more appropriate for this. Using eggDrive to remotely
start an eggPlant Functional script would be like writing a program to launch a web browser instead of simply double-clicking the icon on your desktop.
Use of eggDrive is appropriate if you are looking for fine-grained control of eggPlant Functional capabilities (such as doing individual image searches) from another tool, or
from previously existing scripts written in languages other than SenseTalk.
Documentation on eggDrive can be found here [51].
Command Line Interface
The command line interface (CLI) is the universal, standard method for using one tool from within another. That’s actually why the CLI was invented and it’s one of the most
enduring standards in computing. It’s easy to use, it doesn’t require programming, and everyone supports it.
As our Chief Technical Officer Antony Edwards said, "As a tools buyer, when I hear 'command line integration' I hear simple, quick, robust, easy, and well documented."
Documentation on running eggPlant Functional from the command line can be found here [52].
Simply put, running eggPlant Functional from the command line makes it easy to execute full eggPlant Functional scripts and feed results into test management tools. If
running single SenseTalk commands from scripts written in other languages, then turn to eggDrive.
4
Testing Set-Top Boxes with a Slingbox
Testing Set-Top Boxes with a Slingbox
The closed nature of set-top boxes makes them difficult or impossible for most test automation tools to work with. This article gives step-by-step instructions for connecting
to a set-top box using eggPlant Functional in conjunction with a Slingbox.
What is a Set-Top Box?
A set-top box (STB) is a device that generally contains a TV-tuner input and a display output that connects to a television set and an external signal source. By tuning the
source signal, it can display the content into a form that can then be displayed on the television screen or another display device.
The Slingbox usually has 3 main components:
1. A connection to the output of a video transmitting device (set-top box).
2. A viewer, which will allow you to show the output of the set-top box on a computer through a browser interface.
3. A remote control center (SlingPlayer, the Slingbox software).
Why Use a Slingbox?
The closed nature of set-top boxes makes them difficult for most test automation tools to interact with. Because of this, set-top boxes have traditionally been tested
manually.
eggPlant Functional’s image based approach enables a user to test a set-top box using an intermediate hardware device called a Slingbox. A Slingbox is itself a set-top box
that connects to any other video-output device and streams the signal to your desktop in real time over a network connection.
The Slingbox sends this information to the SlingPlayer software, which must be installed on a Windows or a Mac machine where a VNC server is also installed. You can then
connect to this Windows or Mac machine from eggPlant Functional to test the set-top box.
Note: TestPlant does not provide the Slingbox hardware or software. These must be purchased separately.
Step-by-Step: Connecting to a Set-Top Box
1. Purchase a Slingbox and the related SlingPlayer software. TestPlant does not provide the Slingbox hardware or software. We recommend the Slingbox 350 and
SlingPlayer.
2. Set up the Slingbox with your set-top box. Instructions on how to wire the Slingbox to the set-top box will be provided with the Slingbox.
3. Install the SlingPlayer software on a desktop machine. You can find this software at the Slingbox website
.
[53]
4. Install a VNC server on the same desktop machine as the SlingPlayer software. We recommend RealVNC, which has a free version available to install. You will be
connecting to this machine from eggPlant Functional, which should be running on a separate system.
5. Create a connection from eggPlant Functional to the desktop machine.
You should now be connected to the desktop machine where the SlingPlayer software is running. You are ready to test against the set-top box.
Resources
RealVNC
[54]
Slingbox
[55]
SlingPlayer
[56]
Sending Test Results via Email
Sending Test Results via Email
Both eggPlant Functional and eggPlant Manager offer functionality to send an email as a way to create notifications of test results. Email notifications allow interested parties
to quickly learn the outcomes of test executions and react as needed.
eggPlant Functional uses the SendMail command
notifications at the test level [58].
[57]
to send emails, so these email notifications are controlled at the script level. eggPlant Manager allows you to set
Because each tool takes a different approach to sending emails, the email functionalities can be used separately, or can be combined, to offer strong control over email
reporting. The email functionality of both tools leverages an SMTP server to send emails.
Configuring SMTP settings
Configuration of the SMTP settings in eggPlant Functional or eggPlant Manager is generally the most challenging part of using these email capabilities, but once the
configuration is completed, sending email is very straightforward. Please note that an SMTP server is not provided by TestPlant. You must have an account with an SMTP
server provided by your organization or by a 3rd party, such as GMail. It is often helpful to consult the administrator of the SMTP server to get a good idea of which settings
are relevant to your specific SMTP server. Some trial and error, experimenting with different combinations of settings, can be required when the SMTP server details are
unknown.
eggPlant Functional and eggPlant Manager both take the SMTP settings you provide and attempt to send an email using those settings. If your settings are not correct and the
sending the email is unsuccessful, you will experience an in-application error. eggPlant Functional SendMail errors in Windows are generic and simply indicate that eggPlant
Functional is unable to send an email with the provided SMTP settings. In Mac OS, the generic error can be viewed in Console for additional information on the nature of the
error. eggPlant Manager will also display generic errors when an email notification fails, and more specifics will appear in the eggPlant Manager logs.
eggPlant Functional SMTP Configuration
5
It is possible to set SMTP configuration at either the script or application level. Script-level configuration is achieved by including the smtp_host, smtp_type, smtp_user,
smtp_password, and smtp_port properties and their associated values as part of the sendmail command. If you plan to consistently use the same SMTP server for all emails
sent from eggPlant Functional, we recommend performing the configuration at application level to simplify your code.
You can configure SMTP server settings for the entire eggPlant Functional Preferences [59], found under eggPlant > Preferences > Mail. Provide an SMTP Server ID, Transport
type, Port number, and Authentication type.
Most, but not all, SMTP servers require a User Name and Password, so provide these details when applicable.
Tip: to quickly test whether you have your application-level SMTP configuration correct, write a simple SendMail command and execute the command in eggPlant Functional.
If eggPlant Functional reports that the email was sent, and you receive the test email, then your configuration is correct.
sendMail (To:"test@gmail.com
", Subject:"Test email worked!")
[60]
Below is an example of correct configuration for Gmail within the eggPlant Functional preferences.
eggPlant Manager SMTP Configuration
The eggPlant Manager SMTP configuration can be found in the eggPlant Manager System Preferences [61] under Admin > System Preferences. There is an option to send a test
email to determine whether the SMTP settings are correct. As long as you are using version 3.12 or newer of eggPlant Manager, the eggPlant Manager server does not need
to be restarted in order to commit the SMTP settings.
Setting up Email Notifications
Email Notifications in eggPlant Functional
Because email notifications from eggPlant Functional are controlled by the SendMail command [57], you will have a great deal of control over if and when email notifications
are sent during a script execution. For example, email notifications might only be of interest when a script fails, or when a particular UI element appears on the system under
test. One could also set a SendMail command to run after every execution, using the Settings pane [62] in the eggPlant Functional Suite.
The SendMail command is able to attach files, such as eggPlant Functional log files and screenshots, to the email.
Below is a SenseTalk example that sends an email each time a script finishes execution and sets an appropriate attachment and title depending on the outcome of the
execution.
set TestList to ("script1","script2","script3") -- create a list of the scripts you want to run, in the order in which you’d like to run them
//repeat this process with each script in the list
repeat with each item TestScript of TestList
RunWithNewResults TestScript -- run each script in the test, creating a new set of results for each
put the result into Outcome -- get the result of the script execution and store it in a variable
put TestScript & the long date into title -- create the title for the email
put Outcome's logfile into screenError -- store the file path of the log file
replace "logfile.txt" with "screen_error.tiff" in screenError -- store the file path of the screen error, if there is one
//Use a conditional statement to send the email based on whether or not the script failed
if Outcome's status is "failure"
then
SendMail(To: "elizabeth@testplant.com
",\
[63]
subject:title,\
body:"the test script generated an error.",\
attachment:(screenError, Outcome's Logfile)) -- Indicate the attachments. Note, this will log a warning in your master script log file if there is no screen error to attach.
else
//send an email with the logfile attached
SendMail(to: "elizabeth.simons@testplant.com
",\
[64]
subject: title,\
body: "the test script ran successfully.",\
attachment: Outcome's logfile)
end if
end repeat
eggPlant Manager
Individual tests in eggPlant Manager can be configured to send an email notification at test completion. The email notifications include both a link to the eggPlant Manager
web interface and a .pdf attachment that includes the complete results of the test execution. To read more about configuring email in an eggPlant Performance test, please
see Creating a New Test [58].
6
Special Considerations
If you are using a Microsoft Exchange mail server, the mail server must be configured for SMTP, which is disabled by default.
Currently, eggPlant Manager does not include an option to use no authentication with the SMTP server, so eggPlant Manager will be not able to send emails through servers
without authentication.
Accessing a Data Cell by Name
Accessing a Data Cell by Name
Data sets contained in spreadsheets can be exported as CSV - Comma-Separated Values - files. These files can then be interacted with directly on the local file system.
The following example demonstrates how you can interact with a file on the local file-system. In this case the file used is a CSV containing a header row with column
identifiers, followed by rows of data separated by the comma character.
Creating a CSV File
This section of code deals with the creation of the CSV file. If you already have a CSV file you'd like to use, you can skip to section 2.
-- Define a name for the file:
set myFile to env("temp") & "\myDataFile.csv" -- if using a Mac OS, a possible equivalent would be to use env("TMPDIR")
-- Add some data to the file using put. The 'after' command ensures the text is appended to the file rather than overwriting the existing content:
put "Name,Email,Password" after file myFile
put "John Doe,john@doe.com,jdoe123" & return after file myFile
put "Jane Doe,jane@doe.com,jdoe123" & return after file myFile
put "Joe Bloggs,joe@bloggs.com,jblo123" & return after file myFile
put "Jane Bloggs,jane@bloggs.com,jblo123" & return after file myFile
Reading From a CSV File
SenseTalk makes interacting with files easy and even has built-in support for parsing comma-separated values into indexed containers.
As working with actual values is often more user-friendly than working directly with indexes, the below example demonstrates how you can specify the column and row
names to locate the cell containing the desired data.
// Define a location for the CSV file. This step is required if not using the above code to generate the CSV file, so if that applies to you, simply uncomment and provide a suitable path to your CSV:
-- set myFile to "C:\ePF data\myDataFile.csv"
// Pass in information about what column and row you want to work with. This can be set in the script as it is done below, or passed in from a calling script, or drawn from a data file:
put "Email" into Column
put "Joe Bloggs" into Row
// When you iterate through the data in the CSV file, you’ll need to know the position of the column we’re after.
put line 1 of file myFile into HeaderRow // put the first line into a container
put the item number of Column in HeaderRow into ItemNumber // calculate the index of the column and store it in ItemNumber (starts with 1)
log ItemNumber // this will output the ItemNumber in the log
// With the above index set, you can now iterate through the rows in the data file
repeat with MyLine = each line of line 2 to the last of file myFile // repeats with each row of the .csv file, skipping the header row.
if the first item of MyLine is Row // as soon as the row you are after is found...
then
Log "Found row containing '" & Row & "'"
// at this point you know that the correct row is selected
Put item ItemNumber in MyLine into CellContents // the column index allows us to locate the correct value in the row to store in CellContents
Log "Cell '" & Column & "," & Row & "' contains: " & CellContents
// Optionally log when data was not found, useful for debugging.
(*
else
log "Row did not contain " & Row
*)
end if
end repeat
Using Ask and Answer
Using Ask and Answer to Combine Manual and Automated Testing
Testing is not always an entirely automated or entirely manual task. Under many conditions, combining the two approaches might be the most efficient or reasonable way to
properly test an application. eggPlant Functional includes several useful commands that allow a tester to manually direct the specifics of an automated test during test
execution.
The Ask and Answer family of commands allow the tester to make decisions about test inputs and branching behavior on demand, when the requirements of the application
or test are too complex to be reasonably automated. The commands generate dialog boxes in eggPlant Functional or in the operating system to prompt the tester to make
the decisions at the appropriate times.
These commands leverage the it variable in order to feed the tester’s decision back into the test.
Answer
The Answer command generates a prompt that allows the tester to choose from a set of pre-defined options. Answer is useful when the tester must make a careful decision
about whether a complex interface in the application under test is rendering or behaving properly, or when the tester wants dynamic control over which direction the test
follows in a branching scenario.
Example:
Answer "Does the format of the search results look correct?" with "Yes" or "No" title "Verify Results Formatting" timeout 60 seconds
7
The Answer command above creates the following prompt dialog, with a timeout of 60 seconds:
The response to the above prompt - yes, no, or empty - is returned in the variable "it":
If it is "Yes"
LogSuccess "The formatting is correct!"
else if it is "No"
LogError "The formatting is not correct. The test has failed."
Answer "Which recovery scenario should be run?" with "Application Restart" or "Page Refresh" title "Recovery Scenario Selection"
if it is "Application Restart"
ApplicationRestart
else if it is "Page Refresh"
PageRefresh
end if
else if it is empty -- if the Answer window times out, it is returned empty
LogWarning "The formatting check timed out before a human could check the formatting. Capturing a screenshot for later review!"
CaptureScreen
end if
to ApplicationRestart
Click "Menu"
Click "Exit"
DoubleClick "ApplicationIcon"
end ApplicationRestart
to PageRefresh
Click "Menu"
Click "Refresh"
end PageRefresh
Ask
The Ask command prompts the tester with a field in which they can provide the string of their choice. This command can be helpful for inputting custom log messages or
passwords into a test.
Example:
Ask "What is the username?"
Put it into UserName
Ask Password "What is the password?" //Ask Password is a special variety of Ask that hides the string when it is typed into the prompt field
Put it into Password
Click "UserNameField"
TypeText UserName
Click "PasswordField"
Set the scriptlogging to Silent -- setting scriptlogging to Silent prevents the password from appearing in the log file with the TypeText command
TypeText Password
Log "The password was typed!"
Set the scriptlogging to On
Ask File/Folder and Answer File/Folder
Ask file/folder and Answer file/folder use the operating system’s local file explorer to aid in selecting files for input, or locations to save output.
Answer file of type "txt", ".csv" in folder "C:\Users\Carrie\Desktop"
put it into myFileContents //This Answer file command displays only the files with the specified file extensions
Ask file of type ".txt" in folder "C:\Users\Carrie\Desktop\Results"
put it into myResultsFile
repeat with each line myLine of file myFileContents
Click "SearchField"
TypeText myLine
Put "I am searching for" && myLine & period & CRLF after file myResultsFile
end repeat
8
Special Considerations
These prompts are generated only when the script is executed from Graphical User Interface (GUI) mode, and not from Command Line Interface (CLI) mode, so an eggPlant
Functional Development license must be available on the execution machine.
Additional Information
We also have further documentation regarding the "it" variable [65], Ask and Answer
, and Ask file/folder and Answer file/folder
[66]
.
[67]
Pseudo GPS Locations
Pseudo GPS Locations
There are many reasons for generating pseudo or mock GPS locations on mobile devices. For instance, it can be necessary to spoof a GPS location when a GPS signal is
otherwise unavailable or in instances where a varying GPS location is necessary for fully testing web services on the device. This practice has a valid role in software testing,
though it is good to remember that some sites do not allow this practice.
GPS location spoofing apps provide a way to generate pseudo GPS locations on a mobile device. The main function of such an app is to fool any apps on the device that
leverage your device’s GPS capabilities into thinking that your device is located somewhere other than where it actually is.
GPS location spoofing apps for mobile devices are available for Android, iOS, and Windows. Below is an overview of some available spoofing approaches.
Since use of GPS Spoofing applications and approaches is not always advisable, please take these approaches into consideration with your team to see if these approaches
are a good fit for your testing.
Android
For those doing testing on the Android platform, there are quite a few location spoofing apps readily available on the Google Play store that are generally reliable.
A few of the top free Android location spoofing apps from the Google Play store are:
Catch me if U can
FakeGPS Free
GPSCheaterFree
My Fake Location
iOS
Applications for GPS spoofing on iOS generally require jailbreaking or device modification.
Sources suggest that there are some options in Xcode that can be used to alter GPS locations. It is possible to mock out the CLLocationManager in Xcode for use with the
simulator, and then modify your calls through CustomLocationManager. This then funnels calls through to the Apple implementation, or returns spoofed data, depending on
your needs.
Windows Mobile
The Windows Phone GPS Emulator [68] on the Windows Developer blog will allow you to set a location anywhere on the globe by using the map display. You can also plan
routes with multiple intermediate waypoints, or use Bing services to calculate driving directions between locations. Once you’ve planned a route, you can simulate driving
through the pre-defined waypoints along the path.
Note: The Windows phone will require you to have developer access and knowledge to work with pseudo GPS locations.
Synchronizing Script Execution
Synchronizing Script Executions
Occasionally we receive inquiries from eggPlant Functional users who wish to have their scripts run in a parallel fashion, where one script execution waits for an event to
occur in a second script execution before proceeding. eggPlant Functional is able to achieve a similar functionality by switching the active System Under Test connection with
a Connect command. However, this approach can only automate the SUTs in serial and not truly in parallel.
As separate script executions are handled by separate eggPlant processes, and there is not a mechanism out of the box that allows the processes to be aware of each other,
but through some clever scripting, it is possible to allow script executions to communicate and be synchronized to varying degrees. Note: Please note that parallel script
executions require one eggPlant Functional license for each script executed in parallel.
The easiest way to facilitate communication between the scripts is through a simple, shared external data file, such as a text file, that they can each access independently.
Next, one can override the code for commonly used commands, such as “Click” and “WaitFor”, so that each time the commands are called, communication with the shared
data file is executed, enabling the script executions to remain synchronized.
For a very simple example of how to synchronize running the same script against two different SUTs in parallel, see the related Examples page
.
[69]
The setup requires three different scripts: (1) DrivingScript [70] contains the actual commands that automate the SUTs and perform the test; (2) FirstSUT [71] contains the code
that acts to create a shared data file when a command is executed on the first SUT; and (3) SecondSUT [72] contains the code that checks whether the data file exists before
executing the parallel command on the second SUT.
FirstSUT and SecondSUT leverage handlers with the same names as standard commands to override, or to what is sometimes called overload, the functionality of those
commands in DrivingScript. DrivingScript will be called twice in succession, once for each SUT. The execution using the OverrideScript=FirstSUT parameter must be passed
first, as FirstSUT is the script that controls the initial creation of the shared data file. The two executions of DrivingScript will take turns creating and deleting the shared data
file, while simultaneously taking turns executing each command.
Creating Encrypted Connections with Stunnel
Creating Encrypted Connections with Stunnel
To implement encrypted communication between eggPlant Functional and a System under test (SUT), we recommend using stunnel from www.stunnel.org
creates an SSL (secure Socket Layer) encryption wrapper for the VNC connections that is transparent to both the client and server.
. Stunnel
[73]
Stunnel has binary installers or stand alone executables for Windows and has a text configuration file. For Linux, Unix or MAC platforms you can build from source although
you may prefer to use SSH tunneling (see Tunneling using SSH, below).
Stunnel is free software released under the GNU GPL2 so there are no commercial restrictions for usage although there can be restrictions on the security algorithms for
certain regions. See this page [74] for details.
Stunnel Operation
The VNC connection is configured so that instead of creating a direct unencrypted connection between the client and server, the client connects to a local stunnel instance.
This stunnel then creates an encrypted connection to stunnel running on the system under test. The VNC connection is then tunneled through the encrypted connection and
results in a further local connection on the server between the server stunnel and the VNC server.
9
The client stunnel can be configured so the client can connect to multiple servers.
Step-By-Step: Setting up Stunnel.
1. Download the stunnel installer from www.stunnel.org
[75]
2. Run the installer or extract the files from into a folder using a tool such as 7zip on the eggPlant Functional system. Also install or copy the stunnel files onto the SUT (or
you can use a shared network folder).
The installation folder will contain an example stunnel.conf file.
3. Edit the stunnel.conf file on the eggPlant PC and add the lines:
[SUT1]
client = yes
accept = localhost:5801
connect = MY_SUT_HOST1:5901
Replace MY_SUT_HOST1 with your SUT host or IP address. The local port, 5801, can be any free local port. The section name, e.g. [SUT1] only needs to be unique within
the file. Repeat for each SUT e.g.
[SUT2]
client = yes
accept = localhost:5802
connect = MY_SUT_HOST2:5901
4. Edit the stunnel.conf file on each SUT to add the lines:
[VNC]
accept = 5901
connect = 5900
This assumes your VNC server is using the default port 5900.
5. If running from a command window, run “tstunnel.exe” on each machine. It will automatically load the stunnel.conf in the same folder. If you have installed stunnel using
the installer, there will be various startup options in the Windows Start Menu to start it as a GUI using stunnel.exe or as a service.
6. Add eggPlant Connection list entries for each SUT but pointing to the local address and port as in step 3. e.g.
SUT1, Host=localhost Port=5801
SUT2, Host=localhost Port=5802
The above configuration uses all the default settings for stunnel. There are numerous options for security and using your own certificates etc. See the stunnel documentation
and various articles on the web.
Tunneling using SSH
An alternate method for secure connection tunneling is to use SSH. This uses the same connection architecture as above but using SSH client and servers instead of stunnel.
SSH may be a more suitable approach when using MAC, Linux or Unix that normally includes an SSH client and server as standard.
On Windows putty [76], is a commonly used open source SSH client but the availability of SSH servers on Windows is more limited, particularly non-commercial options; hence
stunnel being recommended for Windows.
An internet search for SSH tunneling will return numerous articles and guides.
Typing Unicode Characters with eggPlant Functional
Typing Unicode Characters with eggPlant Functional
Note: This post is paired with an Examples post which can be found here [77].
As the global reach of eggPlant Functional increases to regions where the ASCII characters set isn’t adequate to address the needs of testers, and as internationalization
demands that testing extend to other languages even in organizations where the Latin alphabet is the norm, the question of how to type extended character sets using
SenseTalk and eggPlant Functional has become increasingly common.
The limitations in this arena lie not with eggPlant Functional, which will send any Unicode character across the connection, but with the VNC servers that are receiving those
characters, though only a bit of the blame can be placed on the VNC server. If you connect to a Windows SUT running a recent release of RealVNC server, open a text editor
like WordPad, and run the following code:
set the remoteworkinterval to 0
repeat with i = 0 to 1024
typetext i & colon && numToChar(i) & return
end repeat
You will see that the expected character is generally typed up to 255 (there is a gap between 127 and 161 for some reason), but beyond that only the occasional erroneous
output is produced. (Note: This code assumes that both sides of the setup are using English-language versions of the operating system and English keyboards; systems using
other languages/keyboards may produce different results. We don’t know of any VNC servers that are engineered to directly support non-English languages.) The main
10
reason that the values between 128 (the end of the standard ASCII character set) and 255 are typed accurately is because they are produced via certain well-defined
keyboard combinations that are mapped in the VNC server. However, beyond 255, there is no standard means of creating any given character using an English keyboard, so
a similar mapping is not practical for those characters.
Typing Unicode Characters on Windows using Modifier Keys
Most operating systems do provide some way of telling the system what character you would like to produce. These generally use the Unicode character value in combination
with one or more modifier keys, and eggPlant Functional can leverage these features to type extended character sets. On Windows, there are two ways of typing Unicode
values. The simpler mechanism requires no configuration of the SUT, but it is limited to Unicode values up to only 9999, which excludes Asian characters, among others. This
approach uses just the Windows Alt key and the number pad of the keyboard. To see the code for this approach, see the related Examples post [78].
There are a couple of things to point out in this code: One is that the typing is sped up by reducing the remoteWorkInterval [79] setting, which is the time between events sent
to the SUT. For multiple TypeText commands, reducing this interval makes the typing faster, which is important because overall this approach slows down text entry quite a
bit. The other thing is the use of the do command [80] to execute a constructed string; do takes any string containing syntactically valid SenseTalk code and runs it. To use the
code, place it in a script called something like “TypeUnicode.script” and then rather than calling TypeText, call the script, e.g.:
TypeUnicode("¥£ÁóƐĢ̧")
Typing Unicode Characters on Windows by Enabling Hex Input
The other approach is very similar, but it requires enabling a Windows setting by editing the registry on the SUT. The advantage of this approach is that it allows the entry of
characters with Unicode values above 10,000, so it allows you type characters in Asian and other non-Latin alphabets. Before you can use this approach, you must enable
Hex input on the Windows SUT using the following procedure:
Step-by-Step: Enabling Hex input on the Windows SUT
1.
2.
3.
4.
5.
6.
On the SUT, open the Start menu, select Run, and enter RegEdit to launch the registry editor.
Navigate to registry entry for HKEY_Current_User/Control Panel/Input Method.
Find the key (or create a new string value) called EnableHexNumpad (if you create this string value, it should have the REG_SZ type.)
Right-click and modify EnableHexNumpad to give it a value of 1.
Close RegEdit.
Log out and into your Windows user session on the SUT to activate the change.
With the updated setting activated you can use code shown in this Examples post
[81]
to enter Unicode Characters.
As with the example for Approach 1, in order to use this code, put it into a script, and call the script instead of calling TypeText. Much of the code is the same as in the
previous handler, but you do not need to call the do command, because you are just typing regular characters and not the ones that are specific to the number pad.
Note: In addition to pressing the Alt key, you also need to type the plus (“+”) sign from the keypad when using this method.
Assuming this script was called “TypeUnicodeHex.script”, you could call it like this:
TypeUnicodeHex("East Asian: ¥
")
TypeUnicodeHex("Georgian: მოგესალმებით")
Typing Unicode on a Mac
A similar tactic can be used on a Mac SUT, but as with the latter Windows method above, the SUT needs to be configured to accept the input.
Step-by-Step: Configuring the Mac SUT to accept Hex Input
1.
2.
3.
4.
Open the System Preferences on the SUT.
Open the Keyboard Control Panel.
Select Input Sources.
If “Unicode Hex Input” is not already available in the list in the lefthand column, click the plus (“+”) button below the list, locate “Unicode Hex Input” in the list displayed
in the popup, select it, and click “Add”. (Note: On Mac OS 10.9 Mavericks, “Unicode Hex Input” is found under “Others” in the list of input sources.)
5. Click the checkbox next to “Show input menu in menu bar” if it is not checked.
6. Click the Input menu in the menu bar and select “Unicode Hex Input”.
You can now use Unicode values to type characters on the SUT in a similar way to that used on Windows SUTs. Again, much of the code is the same. To see the code, view
the related Examples post [82].
This code would be used in the same way as the code for typing on Windows. The code above will type characters with any Unicode value and does not have the same 9999
restriction as the similar code for Windows does.
Note: This approach for typing Unicode characters using a Mac OS SUT works with Vine Server but for unknown reasons does not work with RealVNC server.
Typing on Soft Keyboards
Typing on Soft Keyboards
Typing on the Soft Keyboard of a Mobile Device
The TypeText command can be used to enter text on any SUT. In most situations, this is the simplest and most straightforward approach. However, on mobile devices, it does
not exactly imitate the user experience. In some situations it is desirable to type against the soft keyboard on a mobile device instead of injecting the TypeText events
directly into the system. This is especially useful if your application has a custom soft keyboard that you want to test, or if you just want to imitate the user experience more
closely.
This scenario is also a great example of where modularization of scripts is helpful. The code to type against a soft keyboard can be broken out into a handler and stored in a
separate script or handler library. Once this has been created, that code and all of the associated images can be stored in a helper suite [83] and reused over and over again.
Every time you need to interact with a soft keyboard on a mobile device, simply call the related code, and pass the string you want to type to that handler.
See Typing on Soft Keyboards
[84]
in the Examples
[40]
section for an example of what this handler would look like.
Typing on a Soft Keyboard using Swipe Type
Typing on a soft keyboard can be done with the method shown above, where each letter key is tapped individually, imitating the way a user types on the keyboard. However,
swipe type can also be imitated with eggPlant Functional.
While this is a less common method of typing on keyboards, it can be important to test swipe type capability either to more closely mimic the user experience, or to verify
swipe type capability on a custom soft keyboard. Additionally, this method used to script swipe-typing can be modified and applied to other kinds of shape drawing, such as
when using a pattern to unlock a device.
See Typing on Soft Keyboards
[85]
in the Examples
[40]
section for an example of what this handler would look like.
Multiple Word Swipe Type
When doing a swipe type with multiple words, it is important to make sure that the spaces between the words are being created properly. A standard swipe type keyboard is
likely to insert the spaces automatically if no spaces are manually added, but the spaces can also be added in order to ensure correct typing of the desired text.
A line of code like the one below can be used to tap the space key after each word is swipe typed on the keyboard.
Tap "SpaceKey" -- This taps an image of the space key and can be inserted at the end of the handler being called, or in the calling script after each word is passed to the handler.
11
The calling script will need to pass each word to the handler individually, though the handler could also be set up to iterate through a list, and a list could be passed instead.
See Typing on Soft Keyboards
[86]
in the Examples
[40]
section for an example of what the calling script and handler would look like in this scenario.
Connecting to Windows RT Devices
Connecting to Windows RT Devices
Windows RT is the standard Windows 8 OS rebuilt for use on mobile devices. Windows RT devices are unable to run regular Windows 8 applications, though there are
exceptions.
TightVNC is one of the VNC servers that has been re-compiled to run on Windows RT devices. After re-compiling, this VNC Server requires the digital signature to be
overridden in Admin mode in order to run on Windows RT. This is not the same as jailbreaking, which can change the way the device works. This process instead unlocks the
device by running in Admin mode, so that the VNC Server can be installed. Instructions on how to install this VNC Server on a Windows RT device can be found below.
Requirements
Run the device in Admin mode [87]
Install the TightVNC Server [88]
Step-by-step: Running the Device in Admin Mode
1. Download the AdminRights folder [89] to your Windows RT device.
2. Run the ‘runExploit.bat’ file from the extracted folder.
3. Click the “R” button on either your physical or touch keyboard. The command prompt will appear and begin the exploit process to unlock your Windows RT device.
In order for the exploit process to work, it will request administrator privileges on your RT device. Simply ‘allow’ it to receive admin privileges and your Command Prompt
will look something like the picture below.
You may have to wait a few minutes to reach a safe uptime to begin unlocking your device.
4. Once the above step is complete, your Command Prompt will look like the following picture, requesting you to press a Mute or Volume control key. Doing this proves you
are willingly unlocking the device, ensuring the app isn’t maliciously affecting your device.
5. Once you push one of the three buttons (Volume Up, Down, or Mute), the device will begin the process of utilizing the exploit and unlocking your RT device so it can run
unsigned programs. If the unlock process succeeds, it will ask you to press any key and will exit. If it isn’t successful, an error will be thrown. If this happens, restart the
process and try it again.
Note: This unlock process will disappear once the device is rebooted, and it will not automatically attempt to unlock your device again. If you want to run the VNC server
again after rebooting, you will either need to repeat the above process, or follow the steps below so that the device permanently boots up in Admin Mode.
Step-by-Step: Permanently boot up in Admin Mode
The above unlock process will disappear once the device is rebooted, and it will not automatically attempt to unlock your device again. If you want to run the VNC server
again after rebooting, you will either need to repeat the above process, or follow the steps below so that the device permanently boots up in Admin Mode.
Permanently booting up in Admin mode is just a case of running a few extra steps. These added steps simply automate the Admin Mode script to run every time you boot up
your device. They require you to interact with the device much like you do for running the Admin mode program, but it will save you from needing to load up the exploit
program every time you reboot your device.
1. Begin by installing the “runExplot.bat” again, which will look slightly different if you already ran in Admin mode, as pictured below. This time around, instead of clicking
“R”, click “I”. Note: If this is your first time running it, or you rebooted your RT device, it will look just like it did if you tried to run in Admin Mode without installing it.
12
2. Once you click “I,” the process will begin requesting your admin privileges. Once it’s done requesting permission, it will display a message from the Task Scheduler,
noting that you have created a task to run that is labelled “Jailbreak.” Please note that this is not actually jailbreaking the device. This process will run upon boot and
allow your device to run in Admin mode. Once you see this screen, feel free to press any key to close the Command Prompt.
3. Reboot the device.
4. After you reboot and log in, you will notice a Command Prompt is on your device. It should either request administrative permissions, or show the uptime message
below, which is identical to the one you see when running in Admin mode. It may or may not also show a message about being connected to the Internet, depending on
whether or not you previously tried to unlock your device.
5. After this message appears, you’ll see a message appear asking for you to press a Volume control or Mute key. Do as it asks to confirm that you want to go forward with
the process, and your unlock will be complete until you reboot your device.
6. That’s it, your device will now always run in Admin mode when you boot it up! If you reboot your RT device, then you will have to repeat the last two steps again, but
they will appear once you log in to the device, so it should only take a few seconds.
Step-by-Step: Installing a VNC Server on the Windows RT Device
1. Download re-compiled TightVNC server here [90]. There are two ways to install this VNC Server on the device. Either download it directly onto the device from the link
provided, or download it onto a desktop machine and transfer it onto the device. You can use all the methods available on Windows to transfer files in order to transfer
the file onto the device.
2. Follow the instructions for installation that appear on the device.
3. Launch the TightVNC server on the device by tapping the icon.
4. Adjust the TightVNC Server settings as required.
5. Connect to the device from eggPlant Functional by entering the Windows RT device IP address and port in the connection list. For instructions on creating an eggPlant
Functional connection, see Add a System Under Test (SUT) to the Connection List [91].
Notes
13
The Admin rights file and TightVNC Server are not maintained by TestPlant, so we cannot provide any support or guarantees. This process is subject to change without notice.
Framework and Modularity are Key
Framework and Modularity are Key
In the software testing community “framework” and “modularity” are the new buzzwords of the moment. Everyone is asking about how they can best organize their testing
and make use of their scripts for reusability and a more efficient workflow. We describe modularity as the creation of small, independent scripts that represent pieces and
sections of an automated test. These small scripts are then pulled from a script library to construct larger tests and test cases.
Before a script is ever written, time and thought should be taken regarding your testing framework. If you find yourself troubleshooting a 1400 line script or writing a new
script for every new test case needed, ask yourself questions like, “ What do we want to achieve?”, “What are our testing goals?”, “What resources are available?”, “What is
our development process?”, and “How can we create our scripts, so they can be used over and over again?”. This will enable you to get the most reusability of your scripts,
which will save time, money and resources, and will streamline your testing process.
For example, one of our customers in Minneapolis has over 4000 test cases that they perform on a regular basis, but before they wrote even one line of code they spent
several months developing a framework and implementing a script modularity process. This resulted in a very simple design. The framework for those 4000 tests now
consists of 10 very basic templates that add reusable scripts to Master scripts, pull variable information from .csv files and make use of Helper Suites in their eggPlant
Functional testing software. They say the extra time put in at the front end to create their testing framework has saved them innumerable hours in re-scripting, troubleshooting and maintenance of scripts. Now when a change is needed they simply make a change to a small slave script or update a variable data file.
Another customer of ours has created a very minimal testing framework, using a master script with just 3-5 lines. This script draws from a .csv file containing everything
needed for the test, including script commands. Now, when they need to update their tests, a simple update to the .csv file is all that's needed. If this method meets your
testing needs, it is a novel way to create an easily reusable testing framework.
Many teams have created a solid framework for their testing. With a little thought and planning you’ll be able to build a testing framework that allows for modularity and a
more successful testing environment, too.
Keyword Driven Testing with eggPlant Functional
Using eggPlant Functional for Keyword Driven Testing
When discussing types of software testing methodology, either manual or automated, Keyword Driven Testing is a viable option. This document goes through what it is, why
one would want to use this architecture, and how to do so with eggPlant Functional.
What is Keyword Driven Testing?
Keyword Driven Testing is a testing framework that allows for the development of functional test scripts to be separate from the creation of test cases or work flow. Keywords
or action words representing a particular functionality being tested are employed in an external data table along with arguments for each keyword (the data). This is similar
to data driven testing, but rather than feeding in pure data, keywords and the corresponding data are fed into the test execution driver together.
Advantages of Keyword Driven Testing
Although eggPlant Functional test scripts are inherently easy to read and understand, there may be a need to have external control of test cases with no visibility into the
functional scripts within the automation tool. This provides for more control over the test scripts (not as many people working in the development process), reusability across
teams depending on the testing requirements, and provides for simple and updatable data tables.
Using an external data file to outline your test case gives the tester the ability to preserve a manual test or incorporate manual tests into parts of the automated testing.
Since the external file is created in a way that a manual tester can follow, it can be used for either manual, automated or a combination of the two types of testing (see below
for an example of combining the two).
Another advantage is that the testing can grow as development continues. If only two functions are available at the beginning of development, then these can be tested. As
functions continue to be added, supporting scripts can be created in eggPlant as Keyword line items are added to the external control file.
Step-by-Step: Creating a Keyword Driven Test
When testing a retail application, there might be many stand alone activities representing some type of functionality of the application such as Navigate_To_Website,
Register, Search, AddToBasket, Close_Browser etc. If the scripts are set up in a way that all functions can be performed independently of the others, then many, many test
cases can be created using an external Keyword data file.
1. Create a text file containing keywords and data for your test case
Working backwards from the requirements of the QA team can be beneficial and an advantage of this approach. In this web retail example, the external data file
contains a first title row and then subsequent keywords and accompanying data. For our first example, it might look like this (the matching eggPlant Functional scripts
do not necessarily need to be created yet):
2. Create supporting keyword scripts in eggPlant Functional
This is just like creating any other eggPlant Functional script with a requirement that the script name matches the Keyword exactly. For the above example, the only
scripts needed are one called “Register”, and one called “Search”.
3. Bring it all together with a “Master” script
The “Master” script is what will load in all of the keywords and data from the external Keyword file. The script will then cycle through the lines of keywords/data and
execute each script associated with the keyword in the order in which they are listed in the external file. “Master” scripts for Keyword Driven testing will look very
similar and all will require the key elements of executing setup actions, loading in the data, cycling through the keywords, and returning the SUT to it’s original state.
The Master script might look like this:
//Starting state: Win7, no windows open
Navigate_to_Sephora --Call a script to navigate to the website
Load variable with keyword data file
put file "Path/To/File/DataFile.txt" into datafile
Delete line 1 of datafile --Delete the title row
//Runs the actions and data outlined in the external data file
repeat with each line x of datafile
put x into global myline
put item 1 of global myline into Keyword
runwithnewresults(Keyword)
end repeat
Close_Browser --Runs a script to close the browser window
14
//Ending state: Win7, no windows open
4. As product development continues, add keywords to your test case along with supporting eggPlant Functional scripts. For instance, below is the Keyword data file with
an additional activity (“AddToBasket”) as well as additional Search events and a Register event added:
5. In order to combine both automated testing and manual testing using this approach, a flag will need to be added to the “Manual” test line items in the external data file.
Here is an external data file with manual spot checking added in:
In addition, handling of this must be added to the “Master” script as well. The below lines of code can be added as part of a conditional statement:
if Keyword is "*Manual*" --Code added for integrating manual testing
then
answer "Click Continue when Manual Test Complete" with "Continue"
The full script will look like this:
//Starting state: Win7, no windows open
Navigate_to_Sephora --Call a script to navigate to the website
put file "Path/To/File/DataFile.txt" into datafile
Delete line 1 of datafile --Delete the title row
//Runs the actions and data outlined in the external data file
repeat with each line x of datafile
put x into global myline
put item 1 of global myline into Keyword
if Keyword is "*Manual*" --Code added for integrating manual testing
then
answer "Click Continue when Manual Test Complete" with "Continue"
else
runwithnewresults(Keyword)
end if
end repeat
Close_Browser --Runs a script to close the browser window
//Ending state: Win7, no windows open
Localize Results with a Post-Run Script
Localize Results with a Post-Run Script
Since the v12.00 release, eggPlant Functional has supported pre- and post-run scripts. Defined on a per-suite basis, pre- and post-run scripts are executed before and/or after
each script executed from that suite. While originally conceived as being setup and teardown scripts, this functionality has many other uses. This article describes one use for
a post-run script.
A customer in Korea wanted to perform a sort of partial localization of the result file generated by a script run. He was looking to replace the strings “found at” and “unable to
find image” with “
” and “
”, respectively. Since this action needed to be performed after every script run, the post-run script was a natural solution.
A post-run script automatically receives two parameters: The full path to the script that was run, and the result property list, which includes the path to the logfile as one of
its properties. The script in this example uses the logfile path to load that file into a variable, replace the English phrases with their Korean equivalents, and then write the
whole file back out.
Example: Localize.script
params scriptPath, resultPlist--parameters to accept the passed in values
put file resultPlist.logfile into myFile
replace "found at" with "
" in myFile
replace "unable to Find Image" with "
" in myFile
put myFile into file resultPlist.logfile
The code above is in a script called “Localize.script”. To set the script to run after each script in the Suite, open the Settings on the Suite window and set the Localize.script
as the post-run script:
15
After a test script is run, the results file might look like this:
This script could easily be extended to convert even more of the values in the result file to their Korean equivalents (or the language of your choice.)
Note: Currently pre- and post-run scripts have to be stored in the suite that is running them, so you would need to add a copy of the Localize script to any suite that you want
to provide with this functionality.
ADB Command Support
ADB Command Support
This post discusses how to use the ADB (Android Debugging Bridge) command line tool with eggPlant Functional to communicate with an Android device.
Note: You can now use the ADBCall() function
as a scripting example.
[92]
for communicating with Android devices, so the method presented here is no longer required. However, we leave this article
ADB is a command line tool that lets you communicate with an Android device that is connected over USB, or with an emulator. It allows you to pull data from the device such
as application log files, memory usage data, and push and pull applications.This is very useful when doing regression testing, as you can automate the whole process, from
pulling the old application from the device to pushing a new application onto the device, and then testing the application itself.
The only SenseTalk you need to use in eggPlant Functional to do this is the Shell() [93] function, which allows you to initiate a command line call on your eggPlant Functional
machine.
Downloads Required
SDK Download [94]
adb Commands [95]
Step-by-Step: Set-up Instructions
1. Download and install the Android SDK on your eggPlant Functional machine here [94].
2. Plug the device in over USB to your eggPlant Functional machine.
3. Create a script in your suite called "adb", and save the below code in that script:
For Mac:
params MyCommand
16
put shell ("cd /Users/MaxGerrard/Documents/adb/adt-bundle-mac-x86_64-20130729/platform-tools", "./adb" && MyCommand) //Change the cd command to the path of your
platform-tools folder.
For Windows:
params MyCommand
shell "c:\windows\system32\cmd.exe", <</c "C:\Program Files (x86)\adt-bundle-windows-x86_64-20130522\sdk\platform-tools\adb" >> && MyCommand && "> adbexperiment.txt"
shell "c:\windows\system32\cmd.exe", <</c "C:\Program Files (x86)\adt-bundle-windows-x86_64\sdk\platform-tools\adb" >> && MyCommand && "> someFile.txt" //Change the cd
command to the path of your platform-tools folder.
put file "C:\wherever\someFile.txt"
4. Running an adb command on the device is as simple as running an adb command in your script. You simply pass in any adb command you want to run, as shown below:
adb "devices" //Find out what devices are connected
adb "shell dumpsys meminfo -a" //Output the memory information of the device.
Further Resources
adb Commands
[95]
Keeping Your SUT Awake
Keeping Your SUT Awake
There is nothing more frustrating than being deep into your testing when suddenly, due to inactivity on the screen, your screen saver comes on causing your test to fail.
Luckily, there are ways to keep this from happening on your Mac and Windows machines as well as on mobile devices.
Keeping SUTs Awake on Mac and Windows
Mouse Jiggler is a very simple, and free, piece of software you can use on Mac and Windows machines to keep your SUTs awake. Its only function is to "fake" mouse input and
jiggle the mouse pointer back and forth. This feature can be useful for testing purposes when monitoring a long operation that requires little or no activity on the screen so
that you don't have to change your screensaver settings.
You can find Mouse Jiggler for Windows here [96], and for Mac here [97].
Keeping SUTs Awake on Mobile Devices
Most mobile devices have a setting you can choose so that the device doesn't go to sleep when the user isn't using it. The procedure for setting this option is different
depending on the device; follow the appropriate steps below.
For iOS devices:
1.
2.
3.
4.
Go to Settings on the device.
Click General.
Click Auto-Lock.
Click Never.
For Android:
Every Android device has a slightly different method for choosing settings, although the process should be similar to the steps below, which are for the Samsung Galaxy S5.
In addition to preventing the mobile device screen from locking, you need to use eggOn VNC Server to keep the device screen on.
1.
2.
3.
4.
5.
Go to Settings on the device.
Click the Lock Screen icon.
Click "Screen lock."
Choose None.
In eggOn VNC Server, click the Menu icon.
6. Click Settings.
7. Select the "Keep screen on" check box.
8. Restart the server, and you're good to go.
Switching Systems During a Test
Switching Systems During a Test
Often, a test needs to validate that a change made on a different system. For example, updating something via a phone-based application requires validating that in a
desktop client application.
A single eggPlant Functional script can switch between systems-under-test very easily using the Connect command. The Connect command allows you to connect to another
SUT during a script run.
Example:
//Perform actions on SUT 1:
TypeText "email@address.com
", return --Performs actions on existing connection
[98]
Click "SubmitButton" --This submits a form
connect IP.ADDRESS.TO.SUT --The saved name of the SUT from the Connection List can also be used.
#Perform actions on SUT2 -- These actions might check that the submitted form has been received.
17
//Re-connect to SUT 1:
TypeText "email2@address.com
", return --The saved name of the SUT from the Connection List can also be used.
[99]
Click "SubmitButton" --Submit a second form
You can switch back and forth between SUTs as much as you like. There is a video available here [100] that shows testing on defense systems using this method.
Scripting Through a SUT Restart
Scripting through a SUT Restart
A question that comes up from time-to-time is the need to run a script that restarts the SUT. The code referenced below demonstrates the method for scripting through the
restart of a Windows system; you’d do something similar for other operating systems.
You can see this process in action in this forum post
.
[101]
Step-by-Step Process:
1.
2.
3.
4.
Store the current connection information to use as the argument to the connect command after the restart
Script the restart
Wait for the restart to finish
Reconnect to the system
The Windows OS presents a complication that requires a couple of workarounds. The VNC server runs as a service and seems to persist into part of the shutdown process. So
the connection will drop initially, but a reconnect could be made briefly while the machine was shutting down. So to ensure that a successful connection takes place after the
restart, it’s a good idea to add a check for a visual cue to see that the restart is finished. If it is not, assume that you’ve reconnected during the shutdown, force a disconnect,
and start the check over again.
Successful Image Searches Across Mobile Devices
Successful Image Searches Across Mobile Devices
It is well known that an eggPlant Functional script can be created across devices with different operating systems. However, for clarity, this article will go over creating crossdevice search success over multiple devices in the same operating system family (e.g. iOS, Android).
This approach assumes that the variable in your testing is the device itself, not the test app version, operating system, etc.
Follow the guidelines below to ensure reliable testing across mobile devices:
Standardize Your Testing Environment
a. Set all devices to have the same background if possible.
b. Make sure the app version you are testing is consistent across all devices.
c. Make sure the operating system is the same across all devices.
Use Standard Search Practices
1. Consider Use of OCR
If the image is text, you may want to employ OCR across the multiple devices. Although we encourage a standard image search for best performance, it is often helpful
to use OCR when you are comparing straight text that is rendered differently from device to device. Please refer to Working with OCR for more information on Optical
Character Recognition and best practices for OCR.
2. Capture Smaller Images
Capture a small image of a single element on the screen, so that it is unique relative to the rest of the screen.
3. Minimize Background
When you are capturing images, avoid including the background of icons and other elements that may change or vary between devices.
4. Go from High to Low Resolution
In order to streamline any troubleshooting while running across devices, capture images on the device with the highest resolution images. This does not necessarily
mean the highest resolution screen. We are interested in the images themselves.
Examples:
Testing across iPhone and iPad... capture the images on the iPad.
Testing across iPhone 3 and iPhone 4… capture on the iPhone 4 because it has the retina display (higher resolution images) as opposed to the non-retina display of
the iPhone 3.
How to Determine Which Device to Capture Images on First
Start with the device that has the highest resolution of images. Follow the guidelines below to determine which device this will be.
Bring up Remote Viewer windows for all test phones via the VNC Connection.
Make sure all remote viewer windows are showing “Full Size”. If the remote viewer is in this mode, it will show “Scale To Fit” at the top of the remote viewer
window.
Visually compare a couple of images to between the devices. Whichever device has the largest images via the VNC remote viewer window in eggPlant Functional
will be the phone that you will want to capture images and create your script against first.
Example:
When writing a script that will run on both an HTC EVO and a Samsung Galaxy S4, you will want to start capturing images against the HTC EVO, and then move your
script over to work on the S4 as well.
18
When comparing PlayStore icons, the HTC EVO clearly shows a higher resolution image.
Verify Test Success
Ensure that your test is running consistently against the device where you are first testing and capturing images.
Run the Test Against a Second Device
Running the test against a second device will start the process of making any necessary changes to the images or script in order for the same script to run both on the first
device and the second device.
Use the Image Update Tools
If you encounter an image not found error… first try using the Image Update Tools [102]. The image doctor is one of these tools, and it conducts a variety of diagnostic searches
to see what different settings might allow the image to match successfully.
1. If the Image Doctor correctly suggests changing the tolerance and the number is less than 80, correct the image by altering the tolerance to the suggested setting.
2. Similarly, if Tolerance is not a suggested change, corrections can be made using suggested changes to Discrepancy.
3. For Alternate Type, you should only use the suggested type if it applies to the situation (eg: don’t use Text & Pulsing if the screen isn’t shifting).
4. If the Image Doctor finds the image with a different scaling factor (i.e. 0.5) then you can add this search factor into the image search of your script with the following
syntax.
Before: MoveTo ("SomeImage")
After: MoveTo (Image:"SomeImage", Scale:(1.0,0.5))
5. If you notice after several rounds of using the image doctor to troubleshoot, it is coming up with a consistent scaling factor on the second device, you can then set the
default scaling for the entire script rather than for each separate image search:
Example: Set the defaultScale to (1.0,0.5)
6. If there is a clear proportional scaling happening across the images with respect to the change in SUT screen size between device 1 and 2, then the “Proportional”
syntax can be added into the range to account for the image size changes.
Example: MoveTo (Image: "SomeImage", Scale: (1.0,0.5, "Proportional"))
Please refer to the Image Scaling [103] section of Finding Images
very rarely used by itself, outside of a scaling range.
[104]
for a more in-depth explanation of how the different dynamic scaling options work. “Proportional” is
Use Image Collections
If the image doctor is not successful, create an image collection. It can be daunting to consider capturing a new image for each device, but one image per device family (HTC,
Motorola etc.) is usually enough to take care of the differences in rendering. Also be careful when creating image collections to not replace any previously captured images as
those may be the appropriate images in the collection that make the script successful on an alternate device.
1. Name the image according to the device family:
Motorola_GearIcon
Samsung_GearIcon
2. If you have the script running on one Motorola device and then run it on a second Motorola device and run into an image not found… use the Image Doctor to try and
fine-tune that image’s settings before adding another image to your collection. Go to Use Image Doctor above to fine-tune these settings.
Don't Forget OCR!
If eggPlant Functional is searching for an image that is text and it is unsuccessful across multiple devices through the steps above, then try using OCR. Refer to Working with
OCR [105] for all best practices and trouble shooting information for OCR.
Dynamic Data Generation
Dynamic Data Generation
Have you ever wanted to dynamically create data as you write a script? Wished you had more data to work with?
Often when writing a test, you have been given a set of prescribed data in advance. However, sometimes it can be helpful to create data as you go, so that you can conduct
randomized tests or drive your testing from within the script instead of working with an external file.
The applications for dynamic content generation are widely varying. For instance, you can dynamically generate email addresses for testing against a form. Alternately, you
can dynamically create a file on your eggPlant Functional machine to draw data from as you test. This post will cover both of these scenarios.
Using Dynamic Elements in Scripts; Data Generation and Dynamic Variable Creation
19
There are a few approaches to generating data content dynamically within your script. One of these approaches is to use Any. Another is the Random() function. These are
going to be the most common approach to randomized testing in your scripts or conducting data-driven tests, and both will be covered in the following examples.
Using Any
“Any” is a chunk expression that allows you to select a random piece of data from a previously existing list or range. For example, if you store a range of numbers between 1
and 20 in a variable, and then use Any to select one of the numbers, your code might look like this:
put 1..20 into NumberRange
Log any item of NumberRange
The logged number will be any number between 1 and 20, randomly selected by the script at run time. For a more in-depth example using this approach, please see
Dynamically Naming and Creating a File [106].
When you create your data using the Any Command, all of the content is randomly selected, so the data itself is random. As we just established, this randomization is created
out of a base of pre-existing information. So, what if you have a variety of different elements, all of which are variable and need to be assembled into a larger data string?
One example of this is dynamic email generation. In this situation, there are four elements to the email address, three of which are varying. There is the first part of the email
address, which we will call the ‘name’. Then, there is the “@” symbol, followed by a domain name, which is also dynamic. Finally, there is the ending, which can either be
“.com”, ”.net”, or “.org”.
insert (".com",".net",".org") into ListOfEnds
set Part1 to (any item of a..z for each item of 1..6) joined by empty -- make a random first half
set Part2 to (any item of 1..9 for each item of 1..6) joined by empty -- make a random second half
set EmailEnd to any item of ListOfEnds -- choose a random ending
put Part1 & "@" & Part2 & EmailEnd into DynamicAddress -- Compile the email address
Log DynamicAddress -- Log the dynamically created email address
As you can see in the example above, three different parts are chosen randomly using Any, and then concatenated using an ampersand, and stored in a final variable for use
later. This could be typed directly into the Username field of a login screen if desired, using TypeText.
Using Random()
Now, this technique can be incorporated into a larger script which dynamically generates an external file of randomized customer data. The script generating random email
addresses from above can be turned into a handler, and other handlers can then be created to dynamically generate customer names and ID numbers. In turn, the script can
call out to these other handlers to generate the data and then the information returned by these called portions of code can be organized and written out to a file on the local
eggPlant Functional system. To see the full script, click here [107].
The main body of the script consists of a repeat loop which calls the handlers (these could also be made into separate scripts and called as sub-scripts). This loop will repeat
any number of times, as defined by a variable that specifies the number of customer records desired.
//Specify a Location on the eggPlant Functional System for the File to be Created
Put "~/Temp/CustomerData.txt" into myFile
//Define the Number of Records to be Created
Put 20 into numberofRecords
//Create Random File Contents
Repeat numberofRecords times -- repeat the number of times you want rows in your file
//Create Customer ID by Calling Handler
put createID() & comma into Row
//Create Customer Name by Calling Handler
put createName() & comma after Row
//Create Customer Email by Calling Handler
put createEmail() after Row
//Add Row to File
put row & return after FileContents
end repeat
Both the handler for the Name creation and ID creation use the Random() function. The Random() function takes either one or two numbers as parameters, and it then generates a
number either between 0 and the number specified, or between the two specified numbers.
//Create Customer ID
to createID
put random(100000,999999) into customerID -- use the Random function to create the numbers for the ID
put "-" after character 2 of customerID -- put the ID in the correct format by inserting a dash
return customerID -- return the newly created customer ID to the calling handler
end createID
//Generate Random Names for File
to createName
put a..z into Letters -- store the alphabet in a variable using a range
put random(5,10) into NewNameLength -- use the Random function to randomly select a name length
repeat newNameLength times -- repeat for each character in the new customer name
put any item of letters after NewName -- create a new name using random letters
end repeat
return Capitalized(NewName) -- Capitalize the new customer name and return it to the calling handler
end createName
At the end, after everything has been generated, the created contents are written out to the file, creating the file if it did not previously exist, and overwriting any previously
existing data if it did.
//Create File and Store the Created Content in it
put "ID,Name,Email" & return into HeaderRow -- create a header row for the file
put HeaderRow before FileContents -- insert the header row before the previously created content
put fileContents into file myFile -- insert the contents into the file, located on the eggPlant Functional system
20
Dynamic Search Rectangles
Dynamic Search Rectangles
Note: To see the full version of the scripts involved in this example, please visit this forum post
.
[108]
Why Use Dynamic Search Rectangles?
Sometimes a graphical user interface has numerous identical UI elements but there is a requirement to only interact with only certain instances of these elements. For
example, in a file tree, it might be important to interact with specific nodes belonging to a particular folder while not interfering with other nodes in the tree.
A possible testing scenario might be to navigate to folder C:\Program Files (x86)\Adobe\Reader 11.0\Resource\SaslPrep using the Windows Explorer file tree. Because the
distance between the Folder name, folder icon, and node icon is often not static, it is important to limit the reference image to only the unique folder name. Even if this
distance were static, capturing 2 images for each folder in the file path would be necessary: one for when the node is open and one when it is closed, so that the test doesn’t
unintentionally open and close nodes.
The scenario would require 2 x 6 images, 12 images total, because the file path contains 6 folders.
Example Use Case Scenario
Below is a strategy using dynamic search rectangles that can be used to create an efficient, reusable piece of code that opens folders according to an indicated file path.
Because this strategy allows the capture of only 1 image of each folder and then an image of each of the two node states, the total number of images needed in our Suite is
less, which reduces maintenance.
In this dynamic search rectangle strategy, only 6 + (2 x 1) images or 8 images total are necessary. The longer the file path and the more file paths in the test, the more effort
that is saved on capturing images by using this method.
To begin, get familiar with the Points and Rectangles
[109]
section of SenseTalk Reference.
Below are some examples of using Rectangle functions with images.
The image search will be based on the captured image rectangle (blue), but ultimately the element that the code interacts with is the dynamic icon (orange). The dynamic
icon appears in the same position relative to the captured image rectangle.
put imageRectangle(FolderName) into myRectangle
set imageLeft = left (myRectangle)
set imageTop = top(myRectangle)
set imageBottom = bottom(myRectangle)
set StartLeft = imageLeft - 35
set UL = (StartLeft, imageTop)
set BR = imageLeft, imageBottom)
set the SearchRectangle to (UL,BR)
In the above example, the SearchRectangle is set to (UL,BR) for all subsequent code (as a global property) until it is changed with additional code:
set the SearchRectangle to () -- set the SearchRectangle to full screen
Alternatively, the SearchRectangle can be set for a specific image search, as shown here:
If imageFound(ImageName:"NodeClosed", SearchRectangle:(UL,BR))
then
Do Action && foundImageLocation()
else if imageFound(ImageName:"NodeOpen", SearchRectangle:(UL, BR))
log FolderName && "Already Open."
else
log "Highest Folder Level Reached."
end if
Here is a node-opening script called “Nodes” that makes use of both variables and parameters to make it a generic and reusable script:
Put imageRectangle("FirefoxIcon") into myRectangle
-- stores the upper left and lower right hand corner coordinates of the captured image rectangle int o variable myRectangle
Set imageTop = top(myRectangle)
-- sets the variable "imageTop" as the y-coordinate of the upper left hand corner of variable myRectangle
Set imageRight = right(myRectangle)
-- sets the variable as the x-coordinate of the lower right hand corner
These functions can be used in scripts to create dynamic search rectangles based on one reference image.
1. Capture an image of each folder name (blue)
“LocalDisk”
“ProgramFilesx86”
“Adobe”
21
“Reader11”
“Resource”
“SaslPrep”
2. Capture an image of each node state (orange)
“NodeOpen”
“NodeClosed”
In the following code, with A = 35 pixels, a SearchRectangle based on the captured image rectangle (blue) is set.
FolderName is a variable containing the name of the captured image rectangle (blue). Using variables such as FolderName will result in a more generic and therefore, a more
reusable script.
//The code below opens the node for the initiated folder name if the node is not already open.
//Logs a message if a TargetFolder is found and if the highest folder level is reached.
params FolderName, Action, TargetFolder
If imageFound(FolderName)
then
put imageRectangle(FolderName) into myRectangle
set imageLeft = left(myRectangle)
set imageTop = top(myRectangle)
set imageBottom = bottom(myRectangle)
set StartLeft = ImageLeft - 35
set UL = (StartLeft, imageTop)
set BR = (imageLeft, imageBottom)
if imageFound(ImageName:"NodeClosed", SearchRectangle:(UL, BR))
then
Do Action && foundImageLocation()
else if imageFound(ImageName:"NodeOpen", SearchRectangle:(UL,BR))
then
log folderName && "Already Open"
else
log "Highest folder level reached"
end if
else
log folderName && "Not Found"
end if
if imagefound(folderName) and if TargetFolder
then
log "Target Folder" && FolderName && "Opened."
end if
Below, is the master script that calls the node-opening script “Nodes” for each folder in a tree, starting with the first folder to be opened “LocalDisk”. Note how the third
parameter is optional.
Nodes
Nodes
Nodes
Nodes
Nodes
"LocalDisk", Click
"ProgramFilesx86", Click
"Adobe", Click
"Resource", Click
"SaslPrep", Click, YES
To see the full version of the scripts involved in this example, please visit this forum post
.
[108]
Single Machine Testing
Single Machine Testing
eggPlant Functional is designed around a two-system model, described here. This requires that eggPlant Functional runs on one machine (often referred to as the eggPlant
Functional controller), and that tests be executed against a second system, called the SUT (System Under Test).
There are a few ways of circumventing this, if using two systems presents a problem for your team. Options include:
Using a Virtual Machine as your SUT *Recommended*
Using Fast-User Switching on Mac
Using the eggPlant Functional Machine Only *This provides limited functionality*
Using a Virtual Machine
Virtual machines allow you to use eggPlant Functional with its intended architecture, with a desktop machine hosting eggPlant Functional, and a virtual machine acting as the
SUT (System Under Test).
Virtual machines, for those unfamiliar, are a way to run an operating system within a window, sharing resources with the host system. They provide a cost-effective way of
hosting multiple operating systems on the same hardware.
Since a virtual machine behaves as an individual machine, you can use this as a SUT with eggPlant Functional. To set up a virtual machine, you can choose from a variety of
virtual machine hosting products, which include VMWare (which is a commercial product), Parallels (also commercial), and VirtualBox (open source).
Regardless of which option you choose, the method of installation is the same. You will need an installation disk or disk image for the operating system you want to install.
Step-by-Step: Using a Virtual Machine as a SUT
1.
2.
3.
4.
Download/Install the virtual machine product you choose.
After you’ve installed, create a new virtual machine.
The system will prompt you to enter settings for that machine, such as disk size, ram, etc.
Once you’ve created the new machine, boot it up, and install a VNC Server on the virtual machine (you can use RealVNC [54]), noting it’s IP Address. For further
information, please see Installing a VNC Server [110].
5. Open eggPlant Functional, and add the new virtual machine to your connection list [111]. Treat it as any other machine you wish to test against.
Note: The host operating system needs to be the eggPlant Functional controller, and the virtual machine needs to be the SUT. Otherwise, you will get a “hall of mirrors”
effect as VNC will be looking at itself.
Using Fast-User Switching on Mac
22
As long as you are running eggPlant Functional on a Mac OS X (10.4 or later) machine you can author and test on the same computer using fast-user switching. One user will
act as the eggPlant Functional machine, and another will act as the SUT (System Under Test).
Step-by-Step: Using Fast-User Switching to Create a SUT
Once you have eggPlant Functional installed and running as described in the Getting Started guide you should:
1.
2.
3.
4.
5.
6.
7.
8.
9.
Install Vine Server (download [112]) on the local machine.
Enable fast user switching. This can be done by going to System Preferences -> Accounts -> Login Options.
Allocate a user account as the test account. If you do not have another user on the local machine then create one.
Using System Preferences, add Vine Server as a Login Item for the test account.
Close System Preferences.
Switch over to the test account by clicking on the current user’s name in the upper right corner of the screen.
From the test account you should notice that Vine Server starts as soon as you login.
Switch back to the account that you were logged in as: the main account that you normally run eggPlant Functional from.
In eggPlant Functional, establish a connection to the VNC server which should show up under Bonjour servers in the list of available connections (or else via IP address of
the local machine or via “your_Machine_name_here”.local).
By this time you should be able to see the desktop of the other user’s account, and you should be able to author scripts just like you would had eggPlant Functional been
connected to a separate machine. If you are experiencing a repeated window/mirror effect then make sure that you are not connecting to an instance of the VNC server
running on the same user account that is running eggPlant Functional.
Note: If you are testing an Adobe Flash or Flex Application, this setup will most likely not work, due to recent changes made to the Adobe Flash Player and how it deals with
off-screen content.
Using the eggPlant Functional Machine Only
eggPlant Functional uses a two-system model, but under certain conditions it can also be set up using a single system model.
Why Run on a Single System?
This approach is usually used when one person has already developed scripts using the two-system approach with a development license, and another member of the team
would like to run the scripts but does not have a separate machine to use as a SUT.
If a user is working remotely and needs to run a script, but doesn't have access to a VM or physical machine, they can run from the command line on their own machine by
following these instructions.
Requirements
In order for this to work, you will need to use eggPlant Functional via Command Line [52] and you will not be able to access the eggPlant Functional interface. If the eggPlant
application is run in GUI mode on the same machine it will generate a “Hall of Mirrors” effect, as the application will VNC into the same system and will be looking at itself.
Note: Depending on your testing needs, you can also run a single system model by running eggPlant Functional in drive mode using eggDrive
.
[51]
Step-by-Step: Running eggPlant Functional on a Single System
Note: All examples given in these instruction are written as if being run on Windows. Further information for running via command line on other platforms can be found here
[52].
1. For this process, you will need to run eggPlant Functional scripts via the command line. For instructions on how to run via command line on Mac, Windows, or Linux,
please see Running from the Command Line [113].
2. When you are prompted to enter the Connection Information of the SUT (as when using the two-system model), you will instead use the connection information of
localhost, as shown in the example below. The key difference is to connect into your local machine instead of a remote SUT.
Example:
"C:\Users\Abhijith>"C:\Program Files (x86)\eggPlant\runscript.bat" "C:\Users\Abhijith\Web4.suite\Scripts\Win7crossbrowser.script" -host localhost -port 5901
Passing Parameters
You can pass parameters to a single script or the last of multiple scripts to be run. At the end of the runscript call, type -params, and then the parameters, separated by
spaces. In the example below, the parameters are different browsers to be tested.
Example:
"C:\Users\Abhijith>"C:\Program Files (x86)\eggPlant\runscript.bat" "C:\Users\Abhijith\Web4.suite\Scripts\Win7crossbrowser.script" -host localhost -port 5901 –params "Chrome" "Safari"
"Firefox" "Opera"
Data Driven Testing
Data Driven Testing with eggPlant Functional
An often-asked question is how eggPlant Functional can be used for data-driven tests. While eggPlant Functional uses images to drive the user interface, you can certainly
create robust, data-driven tests within eggPlant Functional. The example outlined here uses weather.com to check the weather at various zip codes.
To download the referenced scripts and files, see this forum post
.
[114]
The test application will be the home page of Weather.com. Weather.com offers local forecasts as well as world weather information.
Test Specs
Platform: Windows
Browser: Mozilla Firefox
Test Application: Weather.com
Objective
The following data-driven test uses zip codes as inputs to Weather.com to verify that the website is capable of processing valid and invalid zip codes. The test application,
Weather.com, upon successful recognition of a valid zip code should display the corresponding city, state, and local forecast belonging to the zip code. The test application
should also be capable of realizing invalid zip codes. Therefore, the data set will also include invalid zip codes.
Test Details
Our data-driven test will assume that the local forecast for a corresponding input is correct, and for that matter our test will not be concerned with validating the local
forecast. Our test will however, validate the city and state that will be displayed after Weather.com recognizes an input as a valid/invalid zip code. Our script will accomplish
this by comparing the displayed city and state with the correct information that it will obtain from an external data file. The test application, Weather.com, should not display
a city or a state for an invalid zip code. Weather.com should display a message stating that no information in regard to an invalid entry could be found. Upon successful
validation of a zip code our script will continue to input zip codes into Weather.com until the last zip code read from the data file is processed.
There are two conditions under which our script will log an error:
When the city and state information displayed by Weather.com does not match the corresponding information located in the data file
When Weather.com accepts a non-existent zip code as a valid entry and displays a city and state that should not exist.
Scripts
23
The scripts used for this example make use of the following SenseTalk features. More information on these features can be found in the corresponding documents, which can
be downloaded here [114].
File manipulation
Sensetalk Objects
Writing handlers
The scripts will assume that the test application — the Firefox web browser displaying the Weather.com homepage — is present at the start of test execution.
main.script: Test execution will commence from this script.
parseFile.script: This script will parse the text file into a recognizable data format.
City.script: City is the internal representation of the test data. Note: City’s only handler is asText. More information on the asText handler can be found in the
SenseTalk™ reference manual.
While this test was written against an older version of both the website and the browser, eggPlant Functional’s technology agnostic approach will allow this script to run
against new versions of both the website and the browser with little to no modification. You can take a look at what the data driven test might look like by downloading the
sample suite.
* The “Weather.com” Web site is used here only as convenient, readily available example application. Its use here should not be construed as an endorsement of eggPlant
Functional by Weather.com nor as suggesting that Weather.com is a customer of TestPlant, Inc.
Text Images and Web Browsers
Text Images and Web Browsers
When using Text Images against a web browser running under Windows, you need to be aware of the Text Smoothing setting of both the system and the browser. The
Windows Text Image Generator (TIG) uses system routines to generate Text Images, but browser settings may override system settings causing your Text Images not to
match.
Internet Explorer
By default IE is set to always use ClearType smoothing:
So unless you disable that setting, it doesn’t matter what your system setting is, the text in the browser will be using the ClearType smoothing. The TIG always uses the
system setting, so if the system is set to no smoothing or Standard smoothing and the setting shown above is enabled in IE, then the TIG images won’t match against IE (if
the system setting is also for ClearType, then the TIG should match the browser.)
Safari
Similarly, in Safari the default setting is to use one of Apple’s font smoothing algorithms and you need to explicitly enable the Windows system setting:
Firefox
Firefox also has font settings and there’s an option that determines whether the page can override those settings. But by default FireFox uses the system smoothing setting,
so in most cases text images should just work.
Changing System Settings
When changing the font smoothing in the system, it’s important to click the Apply button after making the change or the change will not be registered — simply clicking “OK”
does not apply the change. The font smoothing settings are found by clicking the “Effects” button under the Appearance tab of the Display Properties dialog:
24
Choose the setting that you want to use and click the OK button on the Effects panel:
Click the Apply button on the Appearance tab to apply the setting to the system:
Most running applications that are controlled by the system setting will immediately start using it, but it may be necessary to restart some applications before you see the
smoothing take effect.
Managing Windows 7 Magnification Settings
Managing Windows 7 Magnification Settings
This post resolves issues with duplication of toolbar icons and extra spaces in text that is seen in eggPlant Functional on Windows 7 when a Display Magnification Setting is
used.
The symptoms are extra tabs appearing in text within eggPlant Functional windows, as well as duplication of toolbar icons and pixelation of icons as shown in the images
below:
25
If you are experiencing these issues, this means that the machine or user account is being run with a setting that makes icons and text on the screen appear larger; eggPlant
Functional doesn’t support this setting.
The setting can be found by following this path: Start Menu > Control Panel > Appearance and Personalization > Display > Make text and other items larger or smaller.
Make sure that the magnification is set to “Smaller – 100% (default)”.
Click Apply, then log out and log back in. If you need to have things displayed larger on your screen, then you will need to lower the display resolution.
Powered by Drupal
Source URL: http://127.0.0.1/?q=content/knowledge-base
Links
[1] http://docs.testplant.com/PDFs/Knowledge%20Base.pdf
[2] http://docs.testplant.com/?q=content/testing-android-smartwatches
[3] http://docs.testplant.com/?q=content/testing-set-top-boxes-slingbox
[4] http://docs.testplant.com/?q=content/sending-test-results-email
[5] http://docs.testplant.com/?q=content/accessing-data-cell-name
[6] http://docs.testplant.com/?q=content/using-ask-and-answer
[7] http://docs.testplant.com/?q=pseudo-gps-locations
[8] http://docs.testplant.com/?q=synchronizing-script-execution
[9] http://docs.testplant.com/?q=creating-encrypted-connections-with-stunnel
[10] http://docs.testplant.com/?q=knolwedge-base/typing-unicode-characters-eggPlant-Functional
[11] http://docs.testplant.com/?q=typing-on-soft-keyboards
[12] http://docs.testplant.com/?q=connecting-windows-rt-devices
[13] http://docs.testplant.com/?q=framework-and-modularity-are-key
[14] http://docs.testplant.com/?q=keyword-driven-testing-eggPlant-Functional
[15] http://docs.testplant.com/?q=localized-results-postrun-script
[16] http://docs.testplant.com/?q=content/adb-command-support
[17] http://docs.testplant.com/?q=content/keep-your-sut-awake
[18] http://docs.testplant.com/?q=content/switching-systems-during-test
[19] http://docs.testplant.com/?q=content/scripting-through-sut-restart
[20] http://docs.testplant.com/?q=content/successful-image-searches-across-mobile-devices
[21] http://docs.testplant.com/?q=content/dynamic-data-generation
[22] http://docs.testplant.com/?q=content/dynamic-search-rectangles
[23] http://docs.testplant.com/?q=content/single-machine-testing
[24] http://docs.testplant.com/?q=content/data-driven-testing
[25] http://docs.testplant.com/?q=content/text-images-and-web-browsers
[26] http://docs.testplant.com/?q=content/managing-windows-7-magnification-settings
[27] http://docs.testplant.com/?q=Documentation-Home
[28] http://docs.testplant.com/?q=content/getting-started-1
[29] http://docs.testplant.com/?q=content/using-eggplant
[30] http://docs.testplant.com/?q=content/eggplant-reference
[31] http://docs.testplant.com/?q=content/sensetalk-reference
[32] http://docs.testplant.com/?q=eggPlant-Performance
[33] http://docs.testplant.com/?q=content/eggplant-manager
[34] http://docs.testplant.com/?q=eggCloud
[35] http://docs.testplant.com/?q=eggMan
[36] http://docs.testplant.com/?q=content/eggbox
[37] http://docs.testplant.com/?q=content/eggplant-network
[38] http://docs.testplant.com/?q=content/eggon
[39] http://docs.testplant.com/?q=content/knowledge-base
[40] http://docs.testplant.com/?q=content/Examples
[41] http://docs.testplant.com/?q=content/faq
[42] http://www.testplant.com/support/tutorials/
[43] http://forums.testplant.com/phpBB2/viewforum.php?f=2&amp;sid=ef4b0b399b15ceb7ebd0957abe126be3
[44] http://www.testplant.com/phpBB2/viewforum.php?f=5&amp;sid=3b0d1b7ca58256b3d760560ff1b95519
[45] http://docs.testplant.com/?q=content/connecting-android-suts
[46] https://www.rogueamoeba.com/nicecast/
[47] http://www.prismsound.com/test_measure/test_home.php
[48] http://www.mathworks.com/solutions/dsp/index.html
[49] http://audio.rightmark.org/index_new.shtml
[50] http://www.m-audio.com
[51] http://docs.testplant.com/?q=content/eggdrive
[52] http://docs.testplant.com/?q=content/running-command-line
[53] http://uk.slingbox.com/go/slingplayer
[54] http://www.realvnc.com
[55] http://www.slingbox.com/Products/Slingbox350/Features
[56] http://www.slingbox.com/Products/SlingplayerApps
[57] http://docs.testplant.com/?q=content/reporting-commands#sendmail-command
[58] http://docs.testplant.com/?q=content/creating-new-test
[59] http://docs.testplant.com/?q=content/mail-preferences
[60] mailto:test@gmail.com
[61] http://docs.testplant.com/?q=content/setting-system-preferences#mail-server-configuration
[62] http://docs.testplant.com/?q=content/suite-editor#settings-pane
[63] mailto:elizabeth@testplant.com
[64] mailto:elizabeth.simons@testplant.com
[65] http://docs.testplant.com/?q=content/b-all-about-it
[66] http://docs.testplant.com/?q=content/user-interaction
[67] http://docs.testplant.com/?q=content/asking-user-choose-file
26
[68] http://blogs.windows.com/windows_phone/b/wpdev/archive/2011/01/28/windows-phone-gps-emulator.aspx
[69] http://docs.testplant.com/?q=synchronizing-script-execution-example
[70] http://docs.testplant.com/?q=synchronizing-script-execution-example#driving-script
[71] http://docs.testplant.com/?q=synchronizing-script-execution-example#first-sut-script
[72] http://docs.testplant.com/?q=synchronizing-script-execution-example#second-sut-script
[73] http://www.stunnel.org
[74] https://www.stunnel.org/sdf_copying.html
[75] http://www.stunnel.org/
[76] http://www.chiark.greenend.org.uk/~sgtatham/putty
[77] http://docs.testplant.com/?q=Examples/typing-unicode-characters-eggPlant-Functional
[78] http://docs.testplant.com/?q=Examples/typing-unicode-characters-eggPlant-Functional#windows-modifier-keys
[79] http://docs.testplant.com/?q=content/run-options#the-remoteworkinterval
[80] http://docs.testplant.com/?q=running-other-scripts-and-handlers#do-command
[81] http://docs.testplant.com/?q=Examples/typing-unicode-characters-eggPlant-Functional#windows-enabling-hex-input
[82] http://docs.testplant.com/?q=Examples/typing-unicode-characters-eggPlant-Functional#mac-enabling-hex-input
[83] http://docs.testplant.com/?q=content/suite-editor#helpers-pane
[84] http://docs.testplant.com/?q=typing-on-soft-keyboards-Example#type-on-soft-keyboard
[85] http://docs.testplant.com/?q=typing-on-soft-keyboards-Example#type-on-swipe-type-keyboard
[86] http://docs.testplant.com/?q=typing-on-soft-keyboards-Example#typing-sentences-with-swipe-type
[87] http://docs.testplant.com/?q=connecting-windows-rt-devices#running-admin-mode
[88] http://docs.testplant.com/?q=connecting-windows-rt-devices#installing-TightVNC
[89] http://www.testplant.com/downloads/AdminRights.zip
[90] http://www.testplant.com/downloads/TightVNC_ARM.zip
[91] http://docs.testplant.com/?q=content/add-sut-connection-list
[92] http://docs.testplant.com/?q=content/mobile-commands-and-functions#adbcall-function
[93] http://docs.testplant.com/?q=content/system-interaction#shell
[94] http://developer.android.com/sdk/index.html
[95] http://developer.android.com/tools/help/adb.html
[96] https://mousejiggler.codeplex.com/
[97] http://www.sticksoftware.com/software/Jiggler.html
[98] mailto:email@address.com
[99] mailto:email2@address.com
[100] http://www.youtube.com/watch?v=7hYxv9D9wBs
[101] http://forums.testplant.com/phpBB2/viewtopic.php?t=1385
[102] http://docs.testplant.com/?q=using-eggPlant-Functional/Finding-Images/Image-Update-Tools
[103] http://docs.testplant.com/?q=content/finding-images#image-scaling
[104] http://docs.testplant.com/?q=content/finding-images
[105] http://docs.testplant.com/?q=content/working-ocr
[106] http://forums.testplant.com/phpBB2/viewtopic.php?p=9889
[107] http://forums.testplant.com/phpBB2/viewtopic.php?p=9890
[108] http://127.0.0.1/?q=forums.testplant.com/phpBB2/viewtopic.php%3Fp%3D10008
[109] http://docs.testplant.com/?q=content/points-and-rectangles
[110] http://docs.testplant.com/?q=content/installing-vnc-server
[111] http://docs.testplant.com/?q=content/connection-list
[112] http://www.testplant.com/dlds/vine/
[113] http://docs.testplant.com/?q=content/windows-running-command-line
[114] http://forums.testplant.com/phpBB2/viewtopic.php?p=10007
27