small medium large xlarge

Test-Driving JavaScript Applications: Rapid, Confident, Maintainable Code

by

Cover image for Test-Driving JavaScript Applications

Test-Driving JavaScript Applications

Rapid, Confident, Maintainable Code

by

Debunk the myth that JavaScript is not easily testable. Whether you use Node.js, Express, MongoDB, jQuery, AngularJS, or directly manipulate the DOM, you can test-drive JavaScript. Learn the craft of writing meaningful, deterministic automated tests with Karma, Mocha, and Chai. Test asynchronous JavaScript, decouple and properly mock out dependencies, measure code coverage, and create lightweight modular designs of both server-side and client-side code. Your investment in writing tests will pay high dividends as you create code that’s predictable and cost-effective to change.

Customer Reviews

Not only does this book provide step-by-step instructions for how to test JavaScript, Venkat also presents a simplified, well-rounded approach to driving out good design. Venkat writes with a compelling and humorous voice that makes the content educational and entertaining.

- Kimberly D. Barnes

Senior software engineer, GoSpotCheck

Venkat has, in his usual inimitable style, taken the swamp of JavaScript testing and drained it into a clear pool. He has taken a welcome pragmatic approach to the subject of testing this sometimes tricky platform, providing framew

- Neal Ford

Director/software architect/meme wrangler, Thoughtworks, Inc.

If you are a seasoned TDD practitioner in another language, this book answers all the questions to test-drive JavaScript applications. If you are a JavaScript programmer who hasn’t yet embraced TDD, Venkat takes you through several real-world examples to get you started with confidence.

- Naresha K.

Chief technologist, Channel Bridge Software Labs

Test-Driving JavaScript Applications has shown me how to use TDD for the front end. This book was exactly what I was looking for. It has practical examples and lots of useful information. I’ve learned good practices, and I’ve stopped writing legacy code.

- Astefanoaie Nicolae Stelian

Senior Programmer, PRISA

See All Reviews

Choose Your Format(s)

  • $48.00 In Stock

    Save $15.00 on the combo pack.

  • $38.00 In Stock
  • $25.00 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

What You Need

A computer with a text editor and your favorite browser. The book provides instructions to install the necessary automated testing-related tools.

Contents & Extracts

  • Automation Shall Set You Free excerpt
    • The Challenges of Change
    • Testing vs. Verification
    • Adoption Automated Verification
    • Why Is It Hard to Verify
    • How to Approach Automated Testing
    • Wrapping Up
  • Creating Automated Tests
    • Test-Drive Your Design
      • Let’s Get Started
      • Design with Positive, Negative, and Exception Tests
      • Design Server-Side Code
      • Measure Server-Side Code Coverage
      • Prepare for Client-Side Testing
      • Design Client-Side Code
      • Measure Client-Side Code Coverage
      • Wrapping Up
    • Test Asynchrony excerpt
      • Server-Side Callbacks
      • Client-Side Callbacks
      • Test Your Promises
      • Wrapping Up
    • Tactfully Tackle Dependencies
      • A Problem and Spiking to Learn
      • Visualize a Modular Design
      • Separate Dependencies Where Possible
      • Employ Test Doubles
      • Inject the Dependencies
      • Test Interactions
      • Use Sinon to Reduce Noise
      • Review and Run
      • Wrapping Up
  • Real-World Automated Testing
    • Test-Drive Node.js Apps excerpt
      • Start with a Strategic—Just Enough—Design
      • Leap Into Tactical—Test First—Design
      • Continue the Design
      • Create a Spike to Gain Insight
      • Modularize to Facilitate Testing
      • Separate Concerns
      • Integrate and Run
      • Review the Coverage and Design
      • Providing HTTP Access
      • Wrapping Up
    • Test-Drive Express Apps
      • Design for Testability
      • Set Up the Express App and Run a Canary Test
      • Design the Database Connection
      • Design the Model
      • Design the Routes
      • Measure Code Coverage
      • Take It for a Drive
      • Wrapping Up
    • Working with the DOM and jQuery
      • Create a Strategic Design
      • Create the Tactical Design with Tests
      • Evolve Code in Small Steps
      • Take the UI for a Short Drive
      • Complete the Design
      • Test with jQuery
      • Measure Code Coverage
      • Wrapping Up
    • Using AngularJS
      • Testing the AngularJS Way
      • Start with an Initial Design
      • Focus on the Controller
      • Design Service Interaction
      • Separate Concerns, Reduce Mocking
      • Continue the Design
      • Design the Service
      • Measure Code Coverage
      • Take the UI for a Drive
      • Wrapping Up
    • Test-Drive Angular 2
      • Spike to Learn Angular
      • Design Angular Apps with Tests
      • Test-Drive the Component
      • Test-Drive the Service
      • Test-Drive the Pipe
      • Test-Drive the BootStrap Code
      • Take It for a Ride
      • Complete the Design
      • Wrapping Up
    • Integrate and Test End-to-End
      • Get to Know Protractor
      • Start the Server and Configure the Database
      • Test jQuery UI
      • Let’s Use a Page Object
      • Test AngularJS UI
      • Test Angular 2 UI
      • Wrapping Up
    • Test-Drive Your Apps
      • The Fruits of Our Efforts
      • Size and Levels of Testing
      • Test Driving: The Programmer’s Guide
      • Test Driving: The Team Lead’s/Architect’s Guide
      • Test Driving: The Manager’s Guide
      • Rock On!

Author

Dr. Venkat Subramaniam is an award-winning author, founder of Agile Developer, Inc., and an adjunct faculty at the University of Houston. He has trained and mentored thousands of software developers in the US, Canada, Europe, and Asia, and is a regularly invited speaker at several international conferences. He’s the (co)author of multiple books, including the 2007 Jolt Productivity award-winning book Practices of an Agile Developer.