Chapter 13. User Guide

Table of Contents

13.1. How to Identify and Access Objects
13.1.1. How to Access Named Objects
13.1.2. How to Access Objects Using Real (Multi-Property) Names
13.1.3. How to Access Objects Using Symbolic Names
13.2. How to Use the Qt API
13.2.1. How to Access Qt Objects
13.2.2. How to Call Functions on Qt Objects
13.2.3. How to Access Qt Enums
13.2.4. How to Use the Qt Convenience API
13.2.5. How to Use Qt Signal Handlers
13.2.6. How to Test Qt Widgets
13.2.7. How to Test non-Qt Widgets in Qt Applications
13.2.8. How to Do Automatic Stress Testing on Qt
13.2.9. How to Test Internationalized Qt AUTs
13.3. How to Use the Web API
13.3.1. How to Find and Query Web Objects
13.3.2. How to Use XPath
13.3.3. How to Access Web Object Properties
13.3.4. How to Call Web Object Functions
13.3.5. How to Use evalJS
13.3.6. How to Use the Web Convenience API
13.3.7. How to Synchronize Web Page Loading for Testing
13.3.8. How to Handle Redirects Involving a Change of Protocol or Hostname
13.3.9. How to Test Web Elements
13.3.10. How to Do Data-driven Web Application Testing
13.3.11. How to Do Web Application Load Testing
13.4. How to Use the Java™ API
13.4.1. How to Find and Query Java™ Objects
13.4.2. How to Call Functions on Java Objects
13.4.3. How to Access Java™ Object Properties
13.4.4. How to Use the Java™ Convenience API
13.4.5. How to Create and Access Java™ Arrays
13.4.6. How to Test Java™ Applications
13.5. How to Use the Windows API
13.5.1. How to Use the nativeObject
13.6. How to Use the Tk API
13.6.1. How to Find and Query Tk Objects
13.6.2. How to Access Tk Object Properties
13.6.3. How to Use tcleval
13.6.4. How to Use the Tk Convenience API
13.6.5. How to Test Tk Widgets
13.7. How to Use Test Statements
13.8. How to Use Event Handlers
13.8.1. Global Event Handlers
13.8.2. Event Handlers for All Objects of a Specified Type
13.8.3. Event Handlers for Specific Objects
13.9. How to Create and Use Synchronization Points
13.10. How to Test Multiple AUTs from a Single Test Script, Using ApplicationContext
13.10.1. How to Start and Access Multiple Applications Under Test
13.10.2. How to Use ApplicationContext Objects
13.11. How to Automate Native Browser Dialogs, Java Applets, Flash/Flex, ActiveX, and more
13.11.1. Automating native browser dialogs (login, certificates, etc.)
13.11.2. Java Applets
13.11.3. Flash, ActiveX, etc.
13.12. How to Create Semi-Automatic Tests that Query for User Input
13.13. How to Create Automatic Screenshots on Test Failures and Errors
13.14. How to Do Keyword-Driven Testing
13.14.1. How to Create a Keyword-Driven Test
13.14.2. How to Create AUT-Specific Support for Keyword Driven Tests
13.14.3. How to Create a Generic Keyword Driver Function
13.15. How to Interact with Files and with the Environment in Test Scripts
13.15.1. How to Interact with External Files in Test Scripts
13.15.2. How to Compare External Files inside Test Scripts
13.15.3. How to Read Environment Variables inside Test Scripts
13.16. How to Access Databases from Squish Test Scripts
13.16.1. How to Compare Application Data with Database Data
13.16.2. How to Log Test Results Directly into a Database
13.17. How to Handle Exceptions Raised in Test Scripts
13.18. How to Modify Squish Functions
13.19. How to Edit and Debug Test Scripts
13.19.1. How to Use the Script Debugger
13.19.2. How to Record After a Breakpoint
13.19.3. How to Use the Spy
13.20. How to Create and Use Verification Points
13.20.1. How to Create and Use Object Property Verifications
13.20.2. How to Do Screenshot Verifications
13.20.3. How to Create and Use Verification Points in Test Scripts
13.21. How to Create and Use Shared Data and Shared Scripts
13.21.1. How to Store and Locate Shared Scripts and Shared Data Files
13.21.2. How to Do Data-Driven Testing
13.21.3. How to Use Test Data in the AUT
13.22. How to Do Automated Batch Testing
13.22.1. Processing Test Results
13.22.2. Automatically Running Tests
13.22.3. Conclusion
13.23. How to Create and Access Application Bindings
13.23.1. Instrumenting and Wrapping
13.23.2. Creating a Test Using the Wrapper Library
13.23.3. How to Explore Wrapper Libraries
13.24. How to Create Cross-Platform Tests
13.24.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 14) and for coverage of Squish's tools see the Tools Reference Manual (Chapter 15) and the IDE Reference Manual (Chapter 16).)

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