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.