Learn the various ways to use Squish’s Pick tool to spy objects and their properties in a less than 5 minute video tutorial!
Learn the various ways to use Squish’s Pick tool to spy objects and their properties in a less than 5 minute video tutorial!
When dealing with a non-standard, dynamic or hard to find object, additional or alternate object properties may be required to properly identify the object.
If you haven’t worked with the Pick tool before, I recommend scanning (at minimum) the following documents before proceeding:
Use the Check Existence and Highlight Object* buttons to confirm Squish can find the object using the updated real name.
*Highlight Object is not available for Web applications
Watch the video below to learn how to install and configure Squish for Flex to test your Flex applications
Using an Eclipse source control integration? Maintain your code and Squish Test Suite version history from a single interface.
Learn more about our Eclipse IDE Integration
In Test Suite settings, point to the object map file to share. Do the same in each test suite where you’d like to use the same object map. That’s it!
Read How can I share an Object Map across test suites? to learn more about sharing an Object Map as well as merging Object Maps.
When manually scripting or debugging a script, the Squish Script Console provides immediate output and syntax confirmation as well as other valuable data.
# Using symbolic name: test.log(waitForObject(":DIV_content"). hierarchicalQualifiedName()) # Using real (multi-property) name: test.log(waitForObject("{id='content' tagName='DIV'}"). hierarchicalQualifiedName())
Console view
Request your free 30 day Squish evaluation
Learn more about Squish
Other Squish Resources (videos, tech articles, user communities and more)
Hi,
froglogic will again be present at the Embedded World Conference in Nuremberg from February 24th – February 26th, 2015.
You will find froglogic at Halle 4 / Booth 4-301 and in the partner section at The Qt Company’s booth (Halle 4 / Booth 4-308) showing live demos of testing embedded HMIs with the Squish GUI Tester.
In addition, Reginald Stadlbauer from froglogic will give a talk at the Embedded World Congress with the title Automated testing of Qt and QML applications / Applying Behavior Driven Development and Testing.
If you would like to schedule a meeting at the Embedded World with a representative of froglogic, please contact us.
To meet us at Embedded World you can register for a free day ticket with the code B300759. For more information, see www.embedded-world.de/en.
The main feature we are working on for the upcoming Squish release is full-fledged BDD support built directly into Squish.
This includes everything from fully understanding Gherkin, the scripting framework to run BDD tests with step implementations in any of our supported script languages, full IDE support (skeleton generation, code completion, integrated debugging, integrated reporting, …) and advanced reports.
If you are interested to learn more about BDD in general, you can have a look at the slides of a talk I gave about this topic last week: http://www.slideshare.net/ReginaldStadlbauer/behavior-driven-gui-testing.
Find Test Suites written in each of the Squish-supported scripting languages (JavaScript, Python, Perl, Tcl and Ruby) along with one or more sample applications to help you get started on your evaluation.
Request your free 30 day Squish evaluation
Learn more about Squish
Other Squish Resources (videos, tech articles, user communities and more)
Separate from calling functions, where parameters and return values exist, top-level Test Cases may also need status or other valuable information to execute properly.
Using Squish you can:
The use of Symbolic Names in scripts is key when creating a maintainable Automated Test Framework.
A Symbolic Name is a string or name, which when looked up in an Object Map, points to a Real Name, or a collection of properties and values used to correctly identify an object. The Object Map is available to the entire Test Suite, and can also be shared across multiple test suites. Learn more.
The image below depicts the Object Map View, where the selected Symbolic Name (top) and the corresponding Real Name (bottom) appear:
The lines of script below represent a Symbolic Name and Real Name as they appear within a Test Case:
// Symbolic Name waitForObject(":addressBookView.listView_ListView"); // Real Name waitForObject("{container=':Quick Addressbook.addressBookView_TableView'" + "id='listView' type='ListView' unnamed='1' visible='true'}");
Symbolic Names can point to Object Map entries, or Real Names which use Regular Expressions or Wild Cards to match patterns of dynamic portions of objects.
froglogic will be at the EclipseCon North America 2015 conference in San Francisco, California, Monday, March 9th through Wednesday, March 11th.
Stop by our booth for a live demo of Squish GUI Tester!
If you would like to schedule a meeting at the EclipseCon North America with a representative of froglogic, please contact us.
For more information see https://www.eclipsecon.org/na2015/.
A great question from our Webinar Q&A session this week: What is the best way to solve implementation differences between platforms (e.g. Windows Vs Unix)?
When dealing with cross-platform applications, for example Java or Qt, the majority of your Squish tests are not impacted by the platform, as your application, and it’s controls/widgets are identical across platforms. Occasionally however differences may exist.
Using Squish there’s an easy way to handle platform differences: Identify and branch for differences
You can try it using our sample Addressbook application, located in:
<squishDir>
In the following script (javascript), lines 12 and 13 are valid for Linux and Windows, but not valid for Mac:
function main() { startApplication("AddressBookSwing.jar"); activateItem(waitForObjectItem(":Address Book_javax.swing.JMenuBar", "File")); activateItem(waitForObjectItem(":File_javax.swing.JMenu", "New...")); activateItem(waitForObjectItem(":Address Book - Unnamed_javax.swing.JMenuBar", "Edit")); activateItem(waitForObjectItem(":Edit_javax.swing.JMenu", "Add...")); type(waitForObject(":Address Book - Add.Forename:_javax.swing.JTextField"), "jane"); type(waitForObject(":Address Book - Add.Surname:_javax.swing.JTextField"), "smith"); type(waitForObject(":Address Book - Add.Email:_javax.swing.JTextField"), "jane@smith.com"); type(waitForObject(":Address Book - Add.Phone:_javax.swing.JTextField"), "123.123.1234"); clickButton(waitForObject(":Address Book - Add.OK_javax.swing.JButton")); activateItem(waitForObjectItem(":Address Book - Unnamed_javax.swing.JMenuBar", "File")); activateItem(waitForObjectItem(":File_javax.swing.JMenu", "Quit")); clickButton(waitForObject(":Address Book.No_JButton")); }
To accommodate the platform difference we’ll:
Which results in the following:
function main() { startApplication("AddressBookSwing.jar"); activateItem(waitForObjectItem(":Address Book_javax.swing.JMenuBar", "File")); activateItem(waitForObjectItem(":File_javax.swing.JMenu", "New...")); activateItem(waitForObjectItem(":Address Book - Unnamed_javax.swing.JMenuBar", "Edit")); activateItem(waitForObjectItem(":Edit_javax.swing.JMenu", "Add...")); type(waitForObject(":Address Book - Add.Forename:_javax.swing.JTextField"), "jane"); type(waitForObject(":Address Book - Add.Surname:_javax.swing.JTextField"), "smith"); type(waitForObject(":Address Book - Add.Email:_javax.swing.JTextField"), "jane@smith.com"); type(waitForObject(":Address Book - Add.Phone:_javax.swing.JTextField"), "123.123.1234"); clickButton(waitForObject(":Address Book - Add.OK_javax.swing.JButton")); if (java_lang_System.getProperty("os.name").indexOf("Mac OS") == 0) { nativeType("<Command+q>"); } else { activateItem(waitForObjectItem(":Address Book - Unnamed_javax.swing.JMenuBar", "File")); activateItem(waitForObjectItem(":File_javax.swing.JMenu", "Quit")); } clickButton(waitForObject(":Address Book.No_JButton")); }
Notice, line 12 in the modified script retrieves the platform where the application is *currently* executing. This is important, as the test may be triggered by a remote system using another platform.
You can try it using our sample Addressbook application, located in:
<squishDir>\examples\java\addressbook
In the following script (javascript), lines 10 and 11 are valid for Linux and Windows, but not valid for Mac:
function main() { startApplication("addressbook"); clickButton(waitForObject(":Address Book.New_QToolButton")); clickButton(waitForObject(":Address Book - Unnamed.Add_QToolButton")); type(waitForObject(":Forename:_LineEdit"), "jane"); type(waitForObject(":Surname:_LineEdit"), "smith"); type(waitForObject(":Email:_LineEdit"), "jane@smith.com"); type(waitForObject(":Phone:_LineEdit"), "123.123.1234"); clickButton(waitForObject(":Address Book - Add.OK_QPushButton")); activateItem(waitForObjectItem(":Address Book - Unnamed_QMenuBar", "File")); activateItem(waitForObjectItem(":Address Book - Unnamed.File_QMenu", "Quit")); clickButton(waitForObject(":Address Book - Delete.No_QPushButton")); }
To accommodate the platform difference we’ll:
Unlike in Java, where the host platform is available with the java_lang_System.getProperty(“os.name”) statement, for Qt the platform should be passed to the squishrunner service when started.
For example, you may start your squishserver using the following commands:
export SQUISH_HOST_OS=`uname`
./squishserver
For Windows, use ver instead of uname:
for /f "delims=" %a in ('ver') do @set SQUISH_HOST_OS=%a
squishserver.exe
Then modify the script as follows:
function getHostOS(){ myAUT = currentApplicationContext(); hostOS = myAUT.environmentVariable("SQUISH_HOST_OS"); return hostOS } function main() { startApplication("addressbook"); clickButton(waitForObject(":Address Book.New_QToolButton")); clickButton(waitForObject(":Address Book - Unnamed.Add_QToolButton")); type(waitForObject(":Forename:_LineEdit"), "jane"); type(waitForObject(":Surname:_LineEdit"), "smith"); type(waitForObject(":Email:_LineEdit"), "jane@smith.com"); type(waitForObject(":Phone:_LineEdit"), "123.123.1234"); clickButton(waitForObject(":Address Book - Add.OK_QPushButton")); if (getHostOS() == "Darwin"){ nativeType("<Command+q>") } else{ activateItem(waitForObjectItem(":Address Book - Unnamed_QMenuBar", "File")); activateItem(waitForObjectItem(":Address Book - Unnamed.File_QMenu", "Quit")); } clickButton(waitForObject(":Address Book - Delete.No_QPushButton")); }
Notice, line 3 in the modified script retrieves the platform where the application is *currently* executing using the value set in the environment variable before starting the squish server. This is important, as the test may be triggered by a remote system using another platform.
Checkout our latest tutorial: Object Map Tips & Tricks
Request your free 30 day Squish evaluation
Learn more about Squish
Other Squish Resources (videos, tech articles, user communities and more)
Squish uses the Object Map to store select properties, and their values or othe object real name, which is then referenced by scripts using a symbolic name.
{text='Yes' type='QPushButton' unnamed='1' visible='1' window=':Address Book - Delete_QMessageBox'}
:Address Book - Delete.Yes_QPushButton
Should the Yes in the button change to Confirm or OK, simply update the property value in the Object Map, and no changes are required in your scripts.
In this case as well, the ‘window’ property value is dynamic, and can be handled with a regular expression or wild card from within the Object Map (or within the script directly) If using an image-based solution, such dynamic changes become a maintenance nightmare.
Changes to objects in an application are handled quickly and from a central location – no updating screenshots or XPaths to objects (however XPath is supported as an option). Additional properties can be added, or undesired or unneeded properties can be removed from an object’s real name as well. The key is the extensive flexibility the Object Map profiles, along with the accuracy with which it can find and interact with objects. Learn more about object vs image-based object recognition
While recording, the Control Bar contains an Insert Script Comment button
Once you complete your recording, by clicking Stop, the comment appears within your script. The following example’s comment is: # Adding a new entry
def main(): startApplication("AddressBookSwing.jar") activateItem(waitForObjectItem(":Address Book_JMenuBar", "File")) activateItem(waitForObjectItem(":File_JMenu", "New...")) activateItem(waitForObjectItem(":Address Book - Unnamed_JMenuBar", "Edit")) activateItem(waitForObjectItem(":Edit_JMenu", "Add...")) # Adding a new entry type(waitForObject(":Address Book - Add.Forename:_JTextField"), "sam") type(waitForObject(":Address Book - Add.Forename:_JTextField"), "<Tab>") type(waitForObject(":Address Book - Add.Surname:_JTextField"), "smith") type(waitForObject(":Address Book - Add.Surname:_JTextField"), "<Tab>") type(waitForObject(":Address Book - Add.Email:_JTextField"), "sam@smith.com") type(waitForObject(":Address Book - Add.Email:_JTextField"), "<Tab>") type(waitForObject(":Address Book - Add.Phone:_JTextField"), "123.123.1234") clickButton(waitForObject(":Address Book - Add.OK_JButton"))
Imagine you want to verify or inspect an item in a menu, drop down list, context menu, etc. You click the menu, and then the Pick tool. Clicking away makes the menu close. How can you possibly ‘pick’ such an object?
As learned in a prior Squish tip of the week, your Squish IDE can create tests and interact with applications through a remote connection. Read more here: Squish tip of the week: Create tests against a remote environment
The Squish IDE now displays the menu item in the Application Objects tree with its associated properties and values in the Properties list.
Using Squish’s Application Context, you can capture memory usage and other key information about your application at runtime.
With each Squish edition, or technology supported, you can us the corresponding toolkit’s API from your test scripts.
This gives you access to your application, and to make calls, beyond what can be done from your application’s user interface alone.
Take for example the Java Convenience API
In JavaFx applications you can have more than one top-level window.
How can you ensure the proper top-level window is in front before interacting with it? Use the .toFront() call.
For example, given a symbolic name of MyWindow1, the line would simply read MyWindow1.toFront()
Search doc.froglogic.com for your toolkit’s convenience API, or your the AUT toolkit API documentation.
(Near) endless possibilities!