You are previewing TestComplete Cookbook.
O'Reilly logo
TestComplete Cookbook

Book Description

Over 110 practical recipes teaching you to master TestComplete – one of the most popular tools for testing automation

  • Learn to produce easily modifiable and maintainable scripts

  • Customize convenient and optimal launches of created tests

  • Explore TestComplete’s possibilities and advantages through illustrative examples and code implementations

In Detail

TestComplete is an automated testing tool, designed for advanced and novice testers alike, to create, manage and run tests for any desktop, Web or rich client software. It does not depend on any development tool, or application type. Your tests will work fine with any application regardless of whether it was created in C#, C++, Delphi, Java, or any other development language. TestComplete is the most efficient tool of its kind, in regards to the price and quality of the product.

This guide takes a refined approach towards quickly learning the capabilities of TestComplete, using relevant illustrations and practical examples. Each example is consonant with true-to-life situations, which testers would come across sooner or later, while automating tests. With the help of these examples, we will look into complex themes and learn how to test web applications in the most effective manner.

Throughout the first chapters, we will be dealing with some fairly simple tasks that are of interest to people new to TestComplete, gradually moving towards advanced-level automation approaches, which are riveting both for novices and experienced TestComplete users.

We will explore various methods of tests creation for study (e.g. recording, modification and manual coding with use of different approaches), learn test creation using different methods(each of them being suitable for a specific use-case), learn how to distinguish between different methods for accessing controls elements, selecting a most appropriate approach for each of the cases in view. We will also undertake distributive testing for the sake of shortening the overall time for test launches.

This practical guide will help you to answer frequently asked questions relating to automation testing and set the tone for the correct direction of your advancements, which are instrumental to organizing automation in your project.

Table of Contents

  1. TestComplete Cookbook
    1. Table of Contents
    2. TestComplete Cookbook
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Getting Started
      1. Introduction
      2. Installing TestComplete
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Creating your first project
        1. How to do it...
        2. How it works...
        3. There's more...
      4. Choosing a scripting language for the project
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      5. Recording your first test
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      6. Modifying the recorded test
        1. How to do it...
        2. How it works...
        3. See also
      7. Saving and restoring user settings
        1. How to do it...
        2. How it works...
        3. There's more...
      8. Creating code templates
        1. How to do it...
        2. How it works...
        3. There's more...
      9. Delaying script execution
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Adding and removing project items
        1. How to do it...
        2. How it works...
        3. There's more...
      11. Understanding how TestComplete interacts with tested applications
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      12. Understanding Object Browser
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      13. Using Object Spy
        1. How to do it...
        2. How it works...
        3. See also
    9. 2. Working with Tested Applications
      1. Introduction
      2. Adding a tested application project item
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Running a tested application from the script
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      4. Terminating a tested application
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. Killing several instances of a tested application
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      6. Closing a tested application
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      7. Running a tested application in the Debug mode
        1. Getting ready
        2. How to do it...
        3. How it works...
      8. Running a tested application under a different user account
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      9. Changing tested application settings dynamically from the script
        1. Getting ready
        2. How to do it...
        3. How it works...
      10. Running external programs and DOS commands
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      11. Testing installers – running an MSI file
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    10. 3. Scripting
      1. Introduction
      2. Entering text into text fields
        1. Getting ready...
        2. How to do it...
        3. How it works...
        4. There's more...
      3. Using wildcards to process objects with variable names
        1. Getting ready...
        2. How to do it...
        3. How it works...
        4. There's more…
        5. See also
      4. Structuring code using loops
        1. Getting ready...
        2. How to do it...
        3. How it works...
      5. Creating property checkpoints
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Creating object checkpoints
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      7. Using global variables
        1. How to do it...
        2. How it works...
        3. There's more...
      8. Testing multilingual applications
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      9. Working with nonstandard controls
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Organizing script code in the project
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      11. Handling exceptions
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      12. Handling exceptions from a different unit
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      13. Creating framework using the OOP approach
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    11. 4. Running Tests
      1. Introduction
      2. Running a single function
        1. Getting ready
        2. How to do it...
        3. How it works...
      3. Verifying test accuracy
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Creating a test plan for regular runs
        1. Getting ready
        2. How to do it…
        3. How it works...
        4. There's more...
        5. See also
      5. Running tests from the command line
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      6. Passing additional parameters to test from the command line
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      7. Organizing test plan runs
        1. Getting ready
        2. How to do it...
        3. How it works...
      8. Scheduling automatic runs at nighttime
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      9. Running tests via Remote Desktop
        1. How to do it...
        2. How it works...
      10. Changing playback options
        1. How to do it...
        2. How it works...
      11. Increasing run speed
        1. How to do it...
        2. How it works...
        3. See also
      12. Disabling a screensaver when running scripts
        1. How to do it...
        2. How it works...
      13. Sending messages to Indicator
        1. How to do it...
        2. How it works...
        3. There's more...
      14. Showing a message window during a script run
        1. How to do it...
        2. How it works...
        3. There's more...
    12. 5. Accessing Windows, Controls, and Properties
      1. Introduction
      2. Choosing Object Tree Model
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      3. Understanding the window's life cycle
        1. Getting ready
        2. How to do it...
        3. How it works...
      4. Ignoring overlapping windows
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Dragging one object into another
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Calling methods asynchronously
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      7. Verifying if an object has a specific property
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      8. Finding objects by properties' values
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      9. Waiting for an object to appear
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      10. Waiting for a property value
        1. Getting ready
        2. How to do it...
        3. How it works...
      11. Mapping custom control classes to standard ones
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      12. Using text recognition to access text from nonstandard controls
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      13. Using Optical Character Recognition (OCR)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      14. Dealing with self-drawn controls not supported by TestComplete
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
    13. 6. Logging Capabilities
      1. Introduction
      2. Posting messages to the log
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      3. Posting screenshots to the log
        1. How to do it...
        2. How it works...
        3. There's more...
      4. Creating folders in the log
        1. How to do it...
        2. How it works...
        3. There's more...
      5. Changing log messages' appearance
        1. How to do it...
        2. How it works...
        3. See also
      6. Assessing the number of errors in the log
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      7. Changing pictures' format
        1. How to do it...
        2. How it works...
        3. There's more...
      8. Comparing screenshots with dynamic content
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      9. Decreasing log size
        1. How to do it...
        2. How it works...
      10. Generating log in our own format
        1. How to do it...
        2. How it works...
        3. There's more...
      11. Exporting log to MHT format
        1. How to do it...
        2. How it works...
      12. Sending logs via e-mail
        1. How to do it...
        2. How it works...
        3. See also
    14. 7. Debugging Scripts
      1. Introduction
      2. Enabling and disabling debugging
        1. How to do it...
        2. How it works...
        3. There's more...
      3. Using breakpoints to pause script execution
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      4. Viewing variables' values
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Debugging tests step by step
        1. Getting ready
        2. How to do it...
        3. How it works...
      6. Evaluating expressions
        1. Getting ready
        2. How to do it...
        3. How it works...
    15. 8. Keyword Tests
      1. Introduction
      2. Recording and understanding Keyword Tests
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      3. Adding new actions to existing Keyword Tests
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      4. Enhancing Keyword Tests using loops
        1. Getting ready
        2. How to do it...
        3. How it works...
      5. Creating object checkpoints
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      6. Calling script functions from Keyword Tests
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      7. Converting Keyword Tests to scripts
        1. How to do it...
        2. How it works...
      8. Creating our own Keyword driver
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    16. 9. Data-driven Testing
      1. Introduction
      2. Generating random data for tests
        1. How to do it...
        2. How it works...
      3. Accessing a specific cell in a table
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Reading all data from a table
        1. Getting ready
        2. How to do it...
        3. How it works...
      5. Using DDT tables for storing expected values
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Changing CSV delimiter and other parameters
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      7. Driving data without using loops
        1. Getting ready
        2. How to do it...
        3. How it works...
      8. Accessing Excel spreadsheets without having MS Office installed
        1. How to do it...
        2. How it works...
      9. Auto-detecting Excel driver
        1. How to do it...
        2. How it works...
        3. There's more...
    17. 10. Testing Web Applications
      1. Introduction
      2. Choosing Web Tree Model
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      3. Using updates for the latest browser versions
        1. How to do it...
        2. How it works...
      4. Performing cross-browser testing
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. Verifying if a text exists on a page
        1. Getting ready
        2. How to do it...
        3. How it works...
      6. Waiting for an element to appear on a page
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      7. Saving screenshots of an entire page
        1. How to do it...
        2. How it works...
        3. See also
      8. Running scripts on a page
        1. How to do it...
        2. How it works...
        3. See also
    18. 11. Distributed Testing
      1. Introduction
      2. Setting up Network Suite and understanding distributed testing
        1. How to do it...
        2. How it works...
        3. There's more...
      3. Copying Project Suite to a Slave workstation
        1. How to do it...
        2. How it works...
        3. There's more...
      4. Using a Master workstation to run tests
        1. How to do it...
        2. How it works...
      5. Using different configuration files for each workstation
        1. Getting ready
        2. How to do it...
        3. How it works...
      6. Sharing data between workstations
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      7. Synchronizing test runs on several workstations
        1. How to do it...
        2. How it works...
        3. See also
    19. 12. Events Handling
      1. Introduction
      2. Creating event handlers
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      3. Disabling the postage of certain error messages
        1. How to do it...
        2. How it works...
        3. See also
      4. Clicking on disabled controls without an error message
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. Handling unexpected windows that affect TestComplete
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      6. Handling unexpected windows that don't affect TestComplete
        1. Getting ready
        2. How to do it...
        3. How it works...
      7. Saving the log to a disk after each test
        1. How to do it...
        2. How it works...
        3. See also
      8. Sending a notification e-mail on timeouts
        1. How to do it...
        2. How it works...
        3. See also
      9. Creating preconditions and postconditions for tests
        1. How to do it...
        2. How it works...
        3. See also
    20. Index