You are previewing An Introduction to Testing Web Applications with twill and Selenium.
O'Reilly logo
An Introduction to Testing Web Applications with twill and Selenium

Book Description

This Short Cut is an introduction to building automated web tests using two tools, twill and Selenium. twill is a simple web scripting language that can be used to automate web tests, while Selenium is a web testing framework that runs in any browser and can be used to test complex web sites that make extensive use of JavaScript.

The best way to use this Short Cut is to run through the examples. We expect that within an hour you can start writing your own functional tests in either twill or Selenium, and within a day you will understand most, if not all, of the possibilities and the limitations of these tools.

Table of Contents

  1. An Introduction to Testing Web Applications with twill and Selenium
    1. Introduction
      1. What Don't We Cover?
      2. What Are twill and Selenium? And Why Not...
      3. Contacting the authors
      4. Acknowledgements
    2. Functional Web Testing with twill
      1. A brief history of twill
      2. What Is twill?
      3. Introducing twill
        1. Filling out forms
        2. Cookie management
        3. Testing for success
        4. Variables
        5. Using the shell
        6. Command reference and help
        7. The twill command line
        8. Scripts
      4. More Advanced twill Features
        1. runfile and run: Executing other scripts and Python commands
        2. String and argument handling
        3. Debugging options
        4. Output control
        5. Miscellaneous HTTP issues
          1. Browser agent string
          2. HTML parsing
          3. HTTP-EQUIV=REFRESH support
          4. HTTP authentication
        6. Organizing your twill tests
        7. Using a framework to organize and run your twill tests
        8. Recording tests with scotch
      5. twill Extensions
        1. check_links: a simple link checker
        2. require: making assertions about pages
        3. csv_iterate: Iterating over values in CSV files
        4. argparse: Passing command-line arguments into scripts
        5. dirstack: Changing directories
        6. formfill: Convenience functions for filling out forms
      6. Using twill from Python
      7. Extending twill Yourself
        1. Writing a simple extension module
        2. Writing domain-specific languages in twill
        3. More on DSLs
    3. Functional Web Testing with Selenium
      1. A Brief History of Selenium
      2. Introducing Selenium Core
      3. Building a Selenium Test Suite
        1. Deploying and running tests
        2. Recording tests with the Selenium IDE
        3. A guide to Selenium commands
          1. Opening web pages by URL
          2. Clicking on links
          3. Clicking on submit buttons
          4. Clicking on checkboxes
          5. Entering text in input fields
          6. Selecting values in drop-down lists
          7. Verifying the state of the application
          8. Using variables
        4. Locating page elements with XPath Checker
        5. Selenium and JavaScript
        6. Asynchronous HTTP requests and Ajax
    4. Testing a Simple Web Application with twill and Selenium
      1. The Django "poll" Application
        1. Installing and running the poll application
      2. The First Step: Charting a Path to Test
      3. The Second Step: Building a Test Script
      4. The Third Step: Controlling the Application Environment
      5. Integrating Fixtures and Tests with unittest
      6. The admin Interface
      7. Recording Some Simple Selenium Tests
      8. Adding a Test Condition to the Script
      9. Concluding Remarks
    5. About the Authors