Chapter 17. User Guide

Table of Contents

17.1. How to Identify and Access Objects
17.1.1. How to Access Named Objects
17.1.2. How to Access Objects Using Real (Multi-Property) Names
17.1.3. How to Access Objects Using Symbolic Names
17.2. How to Use the Qt API
17.2.1. How to Access Qt Objects
17.2.2. How to Call Functions on Qt Objects
17.2.3. How to Access Qt Enums
17.2.4. How to Use the Qt Convenience API
17.2.5. How to Use Qt Signal Handlers
17.2.6. How to Test Qt Widgets
17.2.7. How to Test non-Qt Widgets in Qt Applications
17.2.8. How to Do Automatic Stress Testing on Qt
17.2.9. How to Test Internationalized Qt AUTs
17.3. How to Use the Web API
17.3.1. How to Find and Query Web Objects
17.3.2. How to Use XPath
17.3.3. How to Access Web Object Properties
17.3.4. How to Call Web Object Functions
17.3.5. How to Use evalJS
17.3.6. How to Use retrieveJSObject
17.3.7. How to Use the Web Convenience API
17.3.8. How to Synchronize Web Page Loading for Testing
17.3.9. How to Handle Redirects Involving a Change of Protocol or Hostname
17.3.10. How to Test Web Elements
17.3.11. How to Do Data-driven Web Application Testing
17.3.12. How to Do Web Application Load Testing
17.4. How to Use the Java™ API
17.4.1. How to Find and Query Java™ Objects
17.4.2. How to Call Functions on Java Objects
17.4.3. How to Access Java™ Object Properties
17.4.4. How to Use the Java™ Convenience API
17.4.5. How to Create and Access Java™ Arrays
17.4.6. How to Test Java™ Applications
17.5. How to Use the Windows API
17.5.1. How to Use the Microsoft Active Accessibility (MSAA) API for Automating Tests
17.5.2. How to Use the nativeObject Property
17.6. How to Use the Tk API
17.6.1. How to Find and Query Tk Objects
17.6.2. How to Access Tk Object Properties
17.6.3. How to Use tcleval
17.6.4. How to Use the Tk Convenience API
17.6.5. How to Test Tk Widgets
17.7. How to Use the Android API
17.7.1. How to Use the nativeObject Property
17.7.2. How to Use the GestureBuilder class
17.8. How to Use the iOS API
17.8.1. How to Use the GestureBuilder class
17.9. How to Use Test Statements
17.10. How to Use Event Handlers
17.10.1. Global Event Handlers
17.10.2. Event Handlers for All Objects of a Specified Type
17.10.3. Event Handlers for Specific Objects
17.11. How to Create and Use Synchronization Points
17.12. How to Test Multiple AUTs from a Single Test Script, Using ApplicationContext
17.12.1. How to Start and Access Multiple Applications Under Test
17.12.2. Notes on using startApplication with Android
17.12.3. How to Use ApplicationContext Objects
17.13. How to Automate Native Browser Dialogs, ActiveX, and more
17.13.1. Automating native browser dialogs (login, certificates, etc.)
17.13.2. ActiveX
17.14. How to Create Semi-Automatic Tests that Query for User Input
17.15. How to Create Automatic Screenshots on Test Failures and Errors
17.16. How to Do Keyword-Driven Testing
17.16.1. How to Create a Keyword-Driven Test
17.16.2. How to Create AUT-Specific Support for Keyword Driven Tests
17.16.3. How to Create a Generic Keyword Driver Function
17.17. How to Interact with Files and with the Environment in Test Scripts
17.17.1. How to Interact with External Files in Test Scripts
17.17.2. How to Compare External Files inside Test Scripts
17.17.3. How to Read Environment Variables inside Test Scripts
17.18. How to Access Databases from Squish Test Scripts
17.18.1. How to Compare Application Data with Database Data
17.18.2. How to Log Test Results Directly into a Database
17.19. How to Handle Exceptions Raised in Test Scripts
17.20. How to Modify Squish Functions
17.21. How to Edit and Debug Test Scripts
17.21.1. How to Use the Script Debugger
17.21.2. How to Record After a Breakpoint
17.21.3. How to Use the Spy
17.22. How to Create and Use Verification Points
17.22.1. How to Create and Use Object Property Verifications
17.22.2. How to Create and Use Table Verifications
17.22.3. How to Do Screenshot Verifications
17.22.4. How to Create and Use Verification Points in Test Scripts
17.23. How to Create and Use Shared Data and Shared Scripts
17.23.1. How to Store and Locate Shared Scripts and Shared Data Files
17.23.2. How to Do Data-Driven Testing
17.23.3. How to Use Test Data in the AUT
17.24. How to Do Automated Batch Testing
17.24.1. Processing Test Results
17.24.2. Automatically Running Tests
17.24.3. Conclusion
17.25. How to Create and Access Application Bindings
17.25.1. Instrumenting and Wrapping
17.25.2. Creating a Test Using the Wrapper Library
17.25.3. How to Explore Wrapper Libraries
17.26. How to Create Cross-Platform Tests
17.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 18) and for coverage of Squish's tools see the Tools Reference Manual (Chapter 19) and the IDE Reference Manual (Chapter 20).)

[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 20.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.)