Description

Book Synopsis
Learn to write better automated tests that will dramatically increase your productivity and have fun while doing so. This book is a build-your-own adventure designed for individual reading and for collaborative workshops. 

You will build an xUnit automated test framework using JavaScript: initially a clone of Jest, but adding a couple of neat features borrowed from RSpec, the genre-defining tool for behavior-driven development (BDD). Along the way, you will explore the philosophy behind automated testing best practices. The automated test runner is one of the most important innovations within software engineering. But for many programmers, automated testing remains a mystery, and knowing how to write good tests is akin to sorcery.

As the chapters of this book unfold, you will see how the humble test runner is an elegant and simple piece of software. Each chapter picks a single feature to build, like the it function or the beforeEach

Table of Contents
Part 1: Building the Core of a Test Framework In this part we build a barebones implementation of a test runner.Chapter 1: Creating an NPM Package of My Very Own, You will create a new NPM package for concise-test, including an entry-point for the test runner.
Chapter 2: Building it to Define a Testwe’ll implement the it function for defining tests, and start printing out some useful test run information on screen.
Chapter 3: Grouping Tests with Describe, we’ll add support for grouping tests with the describe function, and we’ll continue to build out test reporting on screen.
Chapter 4: Promoting Conciseness with BeforeEach and AfterEachWe continue our quest for concise testing facilities with the addition of beforeEach and afterEach functions.
Chapter 5: Improving Legibility with Expect, We finish off the core of our API by building an abstraction over throw new Error.
Part 2: Constructing a Usable Framework In this part we add features that you’ll use on a daily basis.
Chapter 6: Formatting Expectation ErrorsWe write a formatter for stack traces to help pinpoint failures quickly.
Chapter 7. Automatically Discovering Test FilesWe’ll add test file discovery to our test runner, and add support for running a single file through a command line argument.
Chapter 8: Focusing on Tests with It.Only and Describe.Only, We split out runner into two phases: a discovery phase and an execution phase. In between them, we insert a filter phase to support running only a subset of phases.
Chapter 9: Supporting Asynchronous Tests, We add the ability to wait on tests that return Promise objects, and timing out tests with it.timesOutAfter.
Chapter 10: Reportingwe use a pub-sub model to build a plug-in system for reporters.
Part 3: Extending for Power Users In this part we continue to add advanced features.
Chapter 11: Sharing Behavior with it.BehavesLike, We borrow an important feature from Ruby: inheritance for describe blocks, which gives us a flexible mechanism for removing duplication between test groups.
Chapter 12: Tagging Tests We create a mechanism for running a group of tests based on their tag.
Chapter 13 : Skipping Tests we introduce a number of ways to skip tests, including tests without bodies, and it.skip plus describe.skip functions.
Chapter 14 : Randomizing TestsWe add a runtime flag for randomizing the order of tests, which is a useful technique for catching invisible dependencies between tests.
Part 4: Test Doubles and MocksChapter 15. Understanding test doubleswe create a function that can be used as a test spy and stub.
Chapter 16. Module MocksWe create a system for mocking out entire modules, which is a useful technique when creating component doubles when testing React.

Build Your Own Test Framework

    Product form

    £37.49

    Includes FREE delivery

    RRP £49.99 – you save £12.50 (25%)

    Order before 4pm today for delivery by Sat 27 Jun 2026.

    A Paperback / softback by Daniel Irvine

    1 in stock

      Trusted by thousands of customers. See 2,385+ Customer Reviews

      View other formats and editions of Build Your Own Test Framework by Daniel Irvine

      Publisher: APress
      Publication Date: 10/03/2023
      ISBN13: 9781484292464, 978-1484292464
      ISBN10: 1484292464

      Description

      Book Synopsis
      Learn to write better automated tests that will dramatically increase your productivity and have fun while doing so. This book is a build-your-own adventure designed for individual reading and for collaborative workshops. 

      You will build an xUnit automated test framework using JavaScript: initially a clone of Jest, but adding a couple of neat features borrowed from RSpec, the genre-defining tool for behavior-driven development (BDD). Along the way, you will explore the philosophy behind automated testing best practices. The automated test runner is one of the most important innovations within software engineering. But for many programmers, automated testing remains a mystery, and knowing how to write good tests is akin to sorcery.

      As the chapters of this book unfold, you will see how the humble test runner is an elegant and simple piece of software. Each chapter picks a single feature to build, like the it function or the beforeEach

      Table of Contents
      Part 1: Building the Core of a Test Framework In this part we build a barebones implementation of a test runner.Chapter 1: Creating an NPM Package of My Very Own, You will create a new NPM package for concise-test, including an entry-point for the test runner.
      Chapter 2: Building it to Define a Testwe’ll implement the it function for defining tests, and start printing out some useful test run information on screen.
      Chapter 3: Grouping Tests with Describe, we’ll add support for grouping tests with the describe function, and we’ll continue to build out test reporting on screen.
      Chapter 4: Promoting Conciseness with BeforeEach and AfterEachWe continue our quest for concise testing facilities with the addition of beforeEach and afterEach functions.
      Chapter 5: Improving Legibility with Expect, We finish off the core of our API by building an abstraction over throw new Error.
      Part 2: Constructing a Usable Framework In this part we add features that you’ll use on a daily basis.
      Chapter 6: Formatting Expectation ErrorsWe write a formatter for stack traces to help pinpoint failures quickly.
      Chapter 7. Automatically Discovering Test FilesWe’ll add test file discovery to our test runner, and add support for running a single file through a command line argument.
      Chapter 8: Focusing on Tests with It.Only and Describe.Only, We split out runner into two phases: a discovery phase and an execution phase. In between them, we insert a filter phase to support running only a subset of phases.
      Chapter 9: Supporting Asynchronous Tests, We add the ability to wait on tests that return Promise objects, and timing out tests with it.timesOutAfter.
      Chapter 10: Reportingwe use a pub-sub model to build a plug-in system for reporters.
      Part 3: Extending for Power Users In this part we continue to add advanced features.
      Chapter 11: Sharing Behavior with it.BehavesLike, We borrow an important feature from Ruby: inheritance for describe blocks, which gives us a flexible mechanism for removing duplication between test groups.
      Chapter 12: Tagging Tests We create a mechanism for running a group of tests based on their tag.
      Chapter 13 : Skipping Tests we introduce a number of ways to skip tests, including tests without bodies, and it.skip plus describe.skip functions.
      Chapter 14 : Randomizing TestsWe add a runtime flag for randomizing the order of tests, which is a useful technique for catching invisible dependencies between tests.
      Part 4: Test Doubles and MocksChapter 15. Understanding test doubleswe create a function that can be used as a test spy and stub.
      Chapter 16. Module MocksWe create a system for mocking out entire modules, which is a useful technique when creating component doubles when testing React.

      Recently viewed products

      © 2026 Book Curl

        • American Express
        • Apple Pay
        • Diners Club
        • Discover
        • Google Pay
        • Maestro
        • Mastercard
        • PayPal
        • Shop Pay
        • Union Pay
        • Visa

        Login

        Forgot your password?

        Don't have an account yet?
        Create account