Chapter 5. User Guide

Table of Contents

5.1. How to Identify and Access Objects
5.1.1. How to Access Named Objects
5.1.2. How to Access Objects Using Real (Multi-Property) Names
5.1.3. How to Access Objects Using Symbolic Names
5.2. How to Use the Qt API
5.2.1. How to Access Qt Objects
5.2.2. How to Call Functions on Qt Objects
5.2.3. How to Access Qt Enums
5.2.4. How to Use the Qt Convenience API
5.2.5. How to Use Qt Signal Handlers
5.2.6. How to Test Qt Widgets
5.2.7. How to Test non-Qt Widgets in Qt Applications
5.2.8. How to Do Automatic Stress Testing on Qt
5.2.9. How to Test Internationalized Qt AUTs
5.3. How to Use the Web API
5.3.1. How to Find and Query Web Objects
5.3.2. How to Use XPath
5.3.3. How to Access Web Object Properties
5.3.4. How to Call Web Object Functions
5.3.5. How to Use evalJS
5.3.6. How to Use retrieveJSObject
5.3.7. How to Use the Web Convenience API
5.3.8. How to Synchronize Web Page Loading for Testing
5.3.9. How to Handle Redirects Involving a Change of Protocol or Hostname
5.3.10. How to Test Web Elements
5.3.11. How to Do Web Application Load Testing
5.4. How to Use the Java™ API
5.4.1. How to Find and Query Java™ Objects
5.4.2. How to Call Functions on Java Objects
5.4.3. How to Access Java™ Object Properties
5.4.4. How to Use the Java™ Convenience API
5.4.5. How to Create and Access Java™ Arrays
5.4.6. How to Test Java™ Applications
5.4.7. How to Use the GestureBuilder class
5.5. How to Use the Windows API
5.5.1. How to Use the Microsoft Active Accessibility (MSAA) API for Automating Tests
5.5.2. How to Use the nativeObject Property
5.6. How to Use the Tk API
5.6.1. How to Find and Query Tk Objects
5.6.2. How to Access Tk Object Properties
5.6.3. How to Use tcleval
5.6.4. How to Use the Tk Convenience API
5.6.5. How to Test Tk Widgets
5.7. How to Use the Android API
5.7.1. How to Work with Accessibility objects
5.7.2. How to Use the nativeObject Property
5.7.3. How to Use the GestureBuilder class
5.8. How to Use the iOS API
5.8.1. How to Use the GestureBuilder class
5.9. How to Use Test Statements
5.10. How to Use Event Handlers
5.10.1. Global Event Handlers
5.10.2. Event Handlers for All Objects of a Specified Type
5.10.3. Event Handlers for Specific Objects
5.11. How to Create and Use Synchronization Points
5.12. How to Test Multiple AUTs from a Single Test Script, Using ApplicationContext
5.12.1. How to Start and Access Multiple Applications Under Test
5.12.2. Notes on using startApplication with Android
5.12.3. How to Use ApplicationContext Objects
5.13. How to Automate Native Browser Dialogs, ActiveX, and more
5.13.1. Automating native browser dialogs (login, certificates, etc.)
5.13.2. ActiveX
5.14. How to Create Semi-Automatic Tests that Query for User Input
5.15. How to Create Automatic Screenshots on Test Failures and Errors
5.16. How to Do Keyword-Driven Testing
5.16.1. How to Create a Keyword-Driven Test
5.16.2. How to Create AUT-Specific Support for Keyword Driven Tests
5.16.3. How to Create a Generic Keyword Driver Function
5.17. How to Interact with Files and with the Environment in Test Scripts
5.17.1. How to Interact with External Files in Test Scripts
5.17.2. How to Compare External Files inside Test Scripts
5.17.3. How to Read Environment Variables inside Test Scripts
5.18. How to Access Databases from Squish Test Scripts
5.18.1. How to Compare Application Data with Database Data
5.18.2. How to Log Test Results Directly into a Database
5.19. How to Handle Exceptions Raised in Test Scripts
5.20. How to Modify Squish Functions
5.21. How to Edit and Debug Test Scripts
5.21.1. How to Use the Script Debugger
5.21.2. How to Record After a Breakpoint
5.21.3. How to Use the Spy
5.22. How to Create and Use Verification Points
5.22.1. How to Create and Use Object Property Verifications
5.22.2. How to Create and Use Table Verifications
5.22.3. How to Do Screenshot Verifications
5.22.4. Visual Verification Point
5.22.5. How to Create and Use Property Verification Points in Test Scripts
5.23. How to Create and Use Shared Data and Shared Scripts
5.23.1. How to Store and Locate Shared Scripts and Shared Data Files
5.23.2. How to Do Data-Driven Testing
5.23.3. How to Use Test Data in the AUT
5.24. How to Do Automated Batch Testing
5.24.1. Processing Test Results
5.24.2. Automatically Running Tests
5.24.3. Conclusion
5.25. How to Create and Access Application Bindings
5.25.1. Instrumenting and Wrapping
5.25.2. Creating a Test Using the Wrapper Library
5.25.3. How to Explore Wrapper Libraries
5.26. How to Create Cross-Platform Tests
5.26.1. How to Create Cross-Platform Java AWT/Swing Tests

The Squish User's Guide provides explanations of all of Squish most commonly used features, and provides many idiomatic examples of how best to use Squish.

Most of the User Guide is devoted to Squish's scripting support, the different scripting languages Squish supports, and the script APIs which are available when working with test scripts. Many examples are presented to show how to do things in practice. (For a complete reference to the Squish APIs see the API Reference Manual (Chapter 6) and for coverage of Squish's tools see the Tools Reference Manual (Chapter 7) and the IDE Reference Manual (Chapter 8).)

[Important]Unicode UTF-8 File Encoding

The Squish IDE loads and saves test scripts (e.g., files with names matching test.*), as Unicode text using the UTF-8 encoding. All the Squish tools assume that UTF-8 is used for all the scripts they execute. (See the Editor view (Section 8.2.6).) If you don't edit your test scripts using the Squish IDE, make sure that the editor you use loads and saves the scripts using UTF-8; or, if your editor is not Unicode-capable, then the most sensible alternative is to restrict your code to 7-bit ASCII—which all modern editors support—since this is a subset of UTF-8.

Note also that some characters, most notably double quotes (") and backslashes (\), must be quoted in string literals. For example, "C:\\My Documents". (This is a requirement shared by all the scripting languages that Squish supports.)