World Congress 2021 Jun 30, 2021

Test Driven Development with JavaScript

Sascha Depold , Parinaz Roghany

Tired of manual QA slowing down your deployment pipelines? Master the red-green-refactor cycle with Mocha and Chai to build predictable, well-isolated JavaScript applications.

Pause
Mute Enter Fullscreen
#1 about 3 min

Workshop overview and testing agenda

Structuring the test-driven development session establishes clear objectives for automated logic verification.

#2 about 2 min

Defining manual and automated testing

Testing is the process of verifying expectations through manual interaction or automated processes.

#3 about 2 min

Different forms of software testing

Separating software verification into unit, integration, and end-to-end strategies ensures targeted code assurance.

#4 about 3 min

Business and development benefits of testing

Automated tests ensure product health, prevent regressions, and simplify the onboarding process.

#5 about 2 min

Understanding test-driven development strategies

Test-driven development relies on converting specifications into machine-readable verification logic before writing implementation code.

#6 about 3 min

Tools for test structures and assertions

Testing requires tools combining execution structural runners with assertion libraries to verify outcomes.

#7 about 3 min

Introduction to the Fibonacci sequence

The Fibonacci sequence provides a useful numerical pattern for practicing unit test cases.

#8 about 4 min

Planning unit tests with red-green refactoring

Writing initial failing tests to establish expectations prior to implementing functions ensures code accuracy.

#9 about 4 min

Identifying edge cases for function parameters

Gathering invalid input scenarios such as negative numbers and text strings validates robust error handling.

#10 about 4 min

Repository setup and project structure

Cloning the project repository prepares the local codebase for establishing functional test suites.

#11 about 3 min

Formatting unit tests with Mocha and Chai

Structuring automated tests utilizing describe blocks and targeted assertions isolates variable behaviors securely.

#12 about 7 min

Writing standard functional test cases

Evaluating positive test scenarios mathematically validates standard sequence progressions and baseline behaviors.

#13 about 5 min

Implementing tests for error conditions

Checking functional rejections mandates explicit assertions capturing invalid types and improper parameters safely.

#14 about 5 min

Implementing logic to pass failing tests

Translating algorithmic expectations into logic blocks satisfying unit verifications cements mathematical functions accurately.

#15 about 3 min

Resolving performance blocks in recursive functions

Computing expansive test sequences natively exposes strict recursion limits and execution blockages rapidly.

#16 about 4 min

Finalizing logic for edge case inputs

Appending explicit input validations checking for unparseable data ensures functional stability during runtime.

#17 about 3 min

Optimizing code execution with local caching

Bypassing recursive processing overloads requires dynamic memory caching and handling oversized numeric variables.

#18 about 4 min

Applying test-driven principles to APIs

Constructing server endpoint tests establishes functional validations parallel to independent controller behaviors safely.

#19 about 7 min

Configuring Supertest for Express frameworks

Running targeted endpoint evaluations demands bootstrapping isolated web application instances without port conflicts.

#20 about 7 min

Drafting the API endpoint testing suite

Writing validation checks ensures HTTP calls reflect accurate status conditions and expected payload contents.

#21 about 6 min

Handling invalid external requests gracefully

Creating robust HTTP endpoints requires explicit exception handling mechanisms catching unprocessable external payloads.

#22 about 2 min

Isolating tests from network dependencies

Executing unit commands natively necessitates functional disconnections from unstable external network layers.

#23 about 7 min

Mocking implementation controllers using Sinon

Replacing complex internal mechanisms using software mockups provides persistent reliable outputs during cycles.

#24 about 8 min

Intercepting low level HTTP requests using Nock

Overriding low-level network protocol modules simulates distant connectivity variables preventing live network disruptions.

#25 about 2 min

Workshop recap and core testing takeaways

Solidifying integration boundaries separates core algorithmic responsibilities from dynamic external system variables correctly.

#26 about 4 min

Determining test priority in frontend architectures

Structuring frontend verifications poses complexity barriers requiring strategic boundary restrictions limiting browser variables.

#27 about 4 min

Business justification for complete test coverage

Instituting robust testing pipelines unlocks automated deployment speeds bypassing rigid manual code approvals.

#28 about 5 min

Further resources for software testing patterns

Expanding architectural testing techniques incorporates behavior-driven practices streamlining product requirement handoffs securely.

Matching moments

5:27 min

Testing contracts with JavaScript frameworks

Liu Xiaohui · LIVE

4:00 min

Adopting test-driven design as a strategic development methodology

Mirjam Aulbach · WWC 2022

1:18 min

Reflecting on the core motivations for writing tests

Daniel Afonso Daniel Afonso · WWC 2025

2:34 min

Implementing algorithms through test-driven development methodologies and prompts

Markus Walker Markus Walker · WWC 2023

1:28 min

The basic concept of test-driven development

Gil Zilberfeld · JS Congress

8:08 min

Addressing questions on development practices and testing strategies

Mesut Ayata Mesut Ayata · WWC 2024

Upcoming sessions on this topic

Open session

World Congress 2026 North America

Testing React Backends Like a Pro: Mocking Databases with SQLite

David Morris

Solution Architect

David Morris
Open session

World Congress 2026 North America

Reinventing Testing Practices in the AI Era

Eric Deandrea

Java Champion & Senior Principal Software Engineer, IBM

Eric Deandrea
Open session

World Congress 2026 North America

One Repo, One Strategy: Scalable Full-Stack Testing in a Monorepo World

Bartosz Leczycki, Paweł Matynia

Bartosz Leczycki
Paweł Matynia
Open session

World Congress 2026 North America

Agents Can't Iterate Against Tests That Lie

Rocky Warren

Senior Staff Software Engineer at Clipboard

Rocky Warren
Open session

World Congress 2026 North America

Fast by Design: A Masterclass in High-Performance Web Engineering

Aaron Grogg

Senior web developer, committed to improving the user experience by improving web performance

Aaron Grogg
Open session

World Congress 2026 North America

AI-Driven API Design

Mike Amundsen

Author, Adviser, Trainer

Mike Amundsen