Software Test Engineering with IBM Rational Functional Tester: General Script Enhancements
- Test Script Synchronization
- Placing a Generic Delay in Your Script
- Waiting for Test Objects to Come into Existence
- Timing How Long Something Takes to Execute in a Script
- Working with Test Objects
- Working with the Clipboard Object
- Viewing an Objects Properties
- Retrieving All Properties of a Test Object
- Retrieving the Value of a Single Property
- Programmatically Retrieving Data from an Object in My Application
- Determining a Test Objects Valid Test Data Type Arguments to getTestData()
- Using getTestData to Extract Data from a Text Field
- Using getTestData to Extract Data from a List
- Using getTestData() to Read Data in a Table
- Using getTestData() to Extract Data from a Tree
- Obtaining Data from a Test Object That the Rational Functional Tester Verification Point Wizard Does Not Capture
- Creating a Custom Verification Point
- Changing the Value of a Test Objects Property
- Evolving Custom Scripting into Reusable Methods
- Summary
Record and playback can be a successful technique when automating your test cases. It provides a quick and simple means to create the minute programs that verify pieces of your application. Of course, the degree of success for this technique depends upon the complexity of the application you are testing. The more complex your application becomes (for example, using third-party controls, multiple tiers of communication, and so on), the less successful a record-and-playback approach becomes.
This chapter is meant to serve as a next step to simply recording and playing back scripts. It serves as a basis for you to build core test automation skills. Subsequent chapters expound on some of the topics found in this chapter. However, before you run (for example, debugging your custom scripting, handling custom controls, building your own proxies, and so on), you must learn to walk. Here you learn to take steps toward running with any automation effort. These steps include: learning how to synchronize your scripts with any latency found in your application, manipulating data, using the Clipboard object (think, “cut, copy, and paste”), working with the data found in a test object, creating your own custom verification points, and developing your own custom methods that reuse one or more of these techniques.
Test Script Synchronization
It is critical for script playback to stay synchronized with the application it tests. In Chapter 1, “Overview of Rational Functional Tester,” you saw that Rational Functional Tester had playback settings that enabled you to increase the amount of time it would wait for a GUI object to render. The playback settings affect all scripts, not just the ones with which you are experiencing issues. Further, they are specific to each installation of Rational Functional Tester. You need to be cognizant of this when your team members want to run your scripts from their installations.
This section focuses on building synchronization right into your scripts. You learn how to free yourself from the dependencies of installation-specific, global playback settings. Topics covered include:
- Creating general delays in your scripts using the sleep() methods
- Introducing intelligent delays into your scripts using the waitForExistence() methods
- Writing delays that are triggered by object properties
- Using timers to understand how long a piece of your script takes to execute
The aim of this section is to help you become familiar with enhancing Rational Functional Tester’s default synchronization without being dependent upon global settings. If you build the necessary delays into your scripts, you can take advantage of them from any installation of Rational Functional Tester without the need to adjust playback settings.