Chapter 6. API Reference Manual

Table of Contents

6.1. Tester-Created Special Functions
6.2. Equivalent Script API
6.3. Squish API
6.3.1. Constructors, Functions and Properties
6.3.2. Functions and Properties (macOS)
6.3.3. Object Access Functions
6.3.4. Synchronization Functions
6.3.5. Interaction Functions
6.3.6. Debugging Functions
6.3.7. Conversion Functions
6.3.8. Verification Functions
6.3.9. Script-based Creation of Visual Verification Points
6.3.10. Test Data Functions
6.3.11. Object Map Functions
6.3.12. Application Context
6.3.13. QImage Object
6.3.14. Image Object
6.3.15. Screen Object
6.3.16. ToplevelWindow Object
6.3.17. squishinfo Object
6.3.18. testInteraction Functions
6.3.19. testSettings Object
6.3.20. RemoteSystem Object
6.3.21. User Interface Types
6.3.22. Miscellaneous Functions
6.3.23. Low-Level Functions
6.4. Qt Convenience API
6.4.1. QWebView Class
6.4.2. QML Extension API
6.4.3. GestureBuilder
6.5. Tk Convenience API
6.6. XView Convenience API
6.7. Java™ Convenience API
6.7.1. Native Java Arrays
6.7.2. GestureBuilder
6.7.3. Java™ Hardcoded Synthetic Properties
6.7.4. Java Extension API for Custom Widgets
6.8. macOS Convenience API
6.9. iOS Convenience API
6.9.1. GestureBuilder
6.10. Web Object API
6.10.1. Browser Object
6.10.2. BrowserTab Class
6.10.3. HTML_Anchor Class
6.10.4. HTML_Array Class
6.10.5. HTML_Button Class
6.10.6. HTML_ButtonBase Class
6.10.7. HTML_CheckBox Class
6.10.8. HTML_CalendarEvent Class
6.10.9. HTML_CalendarView Class
6.10.10. HTML_ColorField Class
6.10.11. HTML_CustomButton Class
6.10.12. HTML_CustomButtonBase Class
6.10.13. HTML_CustomComboBox Class
6.10.14. HTML_CustomCheckbox Class
6.10.15. HTML_CustomItem Class
6.10.16. HTML_CustomItemView Class
6.10.17. HTML_CustomRadioButton Class
6.10.18. HTML_CustomSelectList Class
6.10.19. HTML_CustomText Class
6.10.20. HTML_DateChooser Class
6.10.21. HTML_Document Class
6.10.22. HTML_ExpandableSectionHeader Class
6.10.23. HTML_Form Class
6.10.24. HTML_FormElement Class
6.10.25. HTML_ImageButton Class
6.10.26. HTML_Menu Class
6.10.27. HTML_MenuButton Class
6.10.28. HTML_MenuItem Class
6.10.29. HTML_Object Class
6.10.30. HTML_Option Class
6.10.31. HTML_RadioButton Class
6.10.32. HTML_Select Class
6.10.33. HTML_ProgressBar Class
6.10.34. HTML_Style Class
6.10.35. HTML_Table Class
6.10.36. HTML_Tab Class
6.10.37. HTML_TabWidget Class
6.10.38. HTML_Text Class
6.10.39. HTML_TextArea Class
6.10.40. HTML_TextBase Class
6.10.41. HTML_XPathResult Class
6.10.42. JsObject Class
6.10.43. CssColor Type
6.10.44. JavaScript Extension API
6.11. Flex Object API
6.12. Windows Convenience API
6.12.1. GestureBuilder
6.13. Android Convenience API
6.13.1. GestureBuilder
6.13.2. UiAutomator
6.14. Python Notes
6.14.1. Default File Encoding (UTF-8)
6.14.2. Default type of string return values (Unicode)
6.14.3. Squish's Python Modules
6.14.4. Python Symbols Hidden by Squish
6.14.5. Importing Custom Python Modules
6.14.6. Using Squish Functions in Python Modules/Packages
6.14.7. squishtest: Module for embedding Squish in Python Applications
6.14.8. Python Language Documentation
6.15. Tcl Notes
6.15.1. Tcl Language Documentation
6.16. JavaScript Notes and Extension APIs
6.16.1. JavaScript Language Documentation
6.16.2. Language Core
6.16.3. Squish ECMAScript Support
6.16.4. File Object
6.16.5. console Object
6.16.6. OS Object
6.16.7. XML Object
6.16.8. SQL
6.16.9. Socket Object
6.16.10. WebSocket Object
6.16.11. XMLHttpRequest Object
6.16.12. FormData Object
6.17. Perl Notes
6.17.1. Perl Language Documentation
6.18. Ruby Notes
6.18.1. Ruby Language Documentation
6.19. Behavior Driven Testing
6.19.1. Defining Step Implementations using Step
6.19.2. Using Step Patterns with Placeholders
6.19.3. Using Step Patterns with Regular Expressions
6.19.4. The BDD context Object
6.19.5. context.userData: Passing Data Between Steps
6.19.6. Accessing Tables and Multi-Line Text
6.19.7. Defining Step Implementations using Given/When/Then
6.19.8. Step Lookup Order & Overriding Shared Step Implementations
6.19.9. Influencing Scenario Execution from Within Step Implementations
6.19.10. Performing Actions During Test Execution Via Hooks
6.19.11. The Anatomy of a BDD Test Case
6.19.12. Reading Tables from External Files using the From Keyword
6.20. FMI Interface support
6.20.1. FMI Overview
6.20.2. Fmi2Import class
6.20.3. Fmi2Variable class
6.20.4. Fmi2Type class
6.20.5. Fmi2Unit class
6.20.6. Fmi2State class
6.20.7. Examples
6.21. CAN bus support
6.21.1. Overview
6.21.2. CanBusDeviceInfo class
6.21.3. CanBusDevice class
6.21.4. CanBusFrame class
6.21.5. CanBusFrameRepeater class
6.21.6. CanBusFrameReceiver class
6.21.7. CAN frame schema

This chapter documents the script APIs which can be used by Squish test scripts. See the Tutorials and the User Guide's User Guide (Chapter 5) section for complete examples that make use of all the main features that Squish's API offers. (Note that extension APIs are documented in the User Guide: QML Extension API (Section 6.4.2) (Qt), JavaScript Extension API (Section 6.10.44) (Web), and Java Extension API for Custom Widgets (Section 6.7.4) (Java).)

[Note]Convenience Function Parameters

Those functions that take an objectOrName argument can be passed a reference to an object or the symbolic or real (multi-property) name of an object. Those functions that take an object argument must be passed an object reference, and those functions that take an objectName must be passed an object's symbolic or real name. (Object references are returned by the waitForObject, waitForObjectExists, findObject and findAllObjects functions.)

In this chapter we begin by looking at the special functions that testers create to make their tests usable by Squish. Then we will look at the differences between the supported scripting languages, then Squish's API is covered, then the GUI toolkit-specific convenience APIs are covered, and finally some scripting language-specific issues are dealt with. Last but not least, the script API specific to behavior-driven tests is discussed.