Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo
The Way of the Web Tester

Book Description

This book is for everyone who needs to test the web. As a tester, you'll automate your tests. As a developer, you'll build more robust solutions. And as a team, you'll gain a vocabulary and a means to coordinate how to write and organize automated tests for the web. Follow the testing pyramid and level up your skills in user interface testing, integration testing, and unit testing. Your new skills will free you up to do other, more important things while letting the computer do the one thing it's really good at: quickly running thousands of repetitive tasks.

Table of Contents

  1.  Acknowledgements
  2.  It’s Good to See You!It’s Good to See You!
    1. How to Read This Book
    2. A Few Conventions
    3. Fun Bits with Purpose
    4. Online Resources
  3. Part I. Mapping the Pyramid
    1. 1. The Testing Pyramid
      1. It Was Beautiful
      2. The Wheels on the Bus
      3. Three Hard Lessons Learned
      4. Enter the Testing Pyramid
      5. UI Tests
      6. Integration Tests
      7. Unit Tests
      8. Rules of Thumb
      9. Who’s Writing These Things
      10. What We’ve Learned So Far
    2. 2. Smoking User Interface Tests
      1. Another Botched Release
      2. Enter the User Interface Test
      3. How They Work
      4. HTML Is for Asserting
      5. CSS Is for Selecting
      6. What We’ve Learned So Far
    3. 3. Adding UI Tests to Legacy Systems
      1. Step 1: Confirm You’re on the Right Test Page
      2. Step 2: Figure Out Your CSS Selectors
      3. Step 3: Make Your Assertions
      4. What We’ve Learned So Far
    4. 4. Connecting the Dots with Integration Tests
      1. There Is No UI
      2. Enter the Integration Test
      3. How the Web Works
      4. Talking HTTP
      5. Taking a REST
      6. What We’ve Learned So Far
    5. 5. Integration Testing RESTful Web Services
      1. Testing the RESTful Permit API
      2. HTTP GET
      3. HTTP POST
      4. HTTP PUT
      5. HTTP DELETE
      6. What We’ve Learned So Far
    6. 6. Covering Our Bases with Unit Tests
      1. Everything Is Awesome!
      2. The Challenge with UI Tests
      3. Enter the Unit Test
      4. How They Work
      5. Turning It Up
      6. What We’ve Learned So Far
    7. 7. Unit Testing in the Browser with JavaScript
      1. Magic in the Browser
      2. JavaScript and the Pyramid
      3. Bug Hunt
      4. Step 1: Scan the HTML
      5. Step 2: Check the JavaScript
      6. Step 3: Write the Tests
      7. Static vs. Dynamic Typing
      8. Open Mic
      9. What We’ve Learned So Far
    8. 8. Climbing the Pyramid
      1. The Pyramid in Action
      2. Start with the Unit Tests
      3. Step Up to the Integration Tests
      4. Reach for the UI Tests
      5. The Inverted Pyramid
      6. How to Deal with Flaky Tests
      7. What We’ve Learned So Far
  4. Part II. Exploring the Pyramid
    1. 9. Programming 101
      1. The Mechanics of Programming
      2. The Importance of Style
      3. Naming
      4. Spacing
      5. Dealing with Duplication
      6. Playing the Game
      7. Step 1: Fix the Spacing
      8. Step 2: Choose Good Names
      9. Step 3: Tackle Duplication in the Class
      10. Step 4: Remove Duplication in the Test
      11. What We’ve Learned So Far
    2. 10. Organizing Tests: Bringing Method to the Madness
      1. The Land of Confusion
      2. The Beauty of Isolation
      3. The Clarity of Context
      4. Intruder Alert
      5. What We’ve Learned So Far
    3. 11. Effective Mocking
      1. Listen to the Music
      2. Enter the Mock
      3. Step 1: Prepare the Mock
      4. Step 2: Set Expectations
      5. The Shackles of Coupling
      6. The Swamp of Mocking
      7. Ports and Adapters
      8. Open Mic
      9. What We’ve Learned So Far
    4. 12. Writing Tests First
      1. Where to Begin
      2. What Is Test-Driven Development (TDD)?
      3. Step 1: Write a Failing Test
      4. Step 2: Make the Test Pass
      5. Step 3: Refactor
      6. Advantages of Working This Way
      7. Seeing It in Action
      8. Cycle, Rinse, Repeat
      9. Open Mic
      10. What We’ve Learned So Far
      11. Final Words
    5. A1. CSS Cheat Sheet
    6. A2. Google Chrome Developer Tools
  5.  Bibliography