Have a personal or library account? Click to login
Learning Behavior-driven development with Javascript Cover

Learning Behavior-driven development with Javascript

Create powerful yet simple-to-code BDD test suites in JavaScript using the most popular tools in the community

Paid access
|Sep 2025
Product purchase options

Key Features

    Book Description

    This book is ideal for any JavaScript developer who is interested in producing well-tested code. If you have no prior experience with testing, Node.js, or any other tool, do not worry, as they will be explained from scratch.

    What you will learn

    • Understand the basic concepts of BDD and how it is different from classic unit testing
    • Divide your system into different modules that can be tested separately, but at the same time not falling into the trap of unit testing
    • Use Mocha, Sinon.JS, and Chai to write expressive BDD features
    • Implement Cucumber.js to automate tests written in Gherkin so that your stakeholders can understand them
    • Discover how to test asynchronous systems, either based on callbacks or promises
    • Test a RESTful web API and a rich UI using WebDriverJS and Protractor
    • Refactor and keep your test code base maintainable using best practices and patterns such as PageObject

    Who this book is for

    TThis book is ideal for any JavaScript developer who is interested in producing well-tested code. If you have no prior experience with testing, Node.js, or any other tool, do not worry, as they will be explained from scratch.

    Table of Contents

    1. Welcome to BDD
    2. Automating tests with Mocha, Chai & Sinon
    3. Your first BDD spec
    4. CucumberJS and Gherkin
    5. Testing a REST Web API
    6. Testing a UI using WebDriverJS
    7. The Page Object pattern
    8. Testing in several browsers with Protractor
    9. Integration Contract Tests
    10. Final thoughts
    PDF ISBN: 978-1-78439-017-4
    Publisher: Packt Publishing Limited
    Copyright owner: © 2015 Packt Publishing Limited
    Publication date: 2025
    Language: English
    Pages: 392