Free course

Testing JavaScript Applications

Test JavaScript from pure functions to APIs, databases, browsers, CI, and small load checks with Node.js, Testcontainers, Playwright, and k6.

5 modules · 25 lessons · No signup

Prerequisites: JavaScript, Node.js and Web APIs

~~~

Your progress

of lessons completed.

Course completed.

What you'll learn

Build a fast, isolated, diagnosable test strategy for the Books application across unit, integration, browser, and reliability boundaries.

Take this course offline

Subscribe to my newsletter to get every free book and course in PDF and EPUB format.

Get the downloads

Course contents

  1. Testing foundations

    Choose evidence from risk, use the Node test runner, and make tests clear and deterministic.

    1. Choose what a test proves
    2. Run the first Node test
    3. Arrange, act, and assert
    4. Make tests deterministic
    5. Check your understanding: testing foundations
  2. Unit tests

    Test pure domain logic, boundaries, injected dependencies, and focused test doubles.

    1. Extract pure domain logic
    2. Test boundaries with tables
    3. Inject dependencies
    4. Use test doubles sparingly
    5. Check your understanding: unit tests
  3. Integration tests

    Test the HTTP stack, real schemas, migrations, SQLite, and disposable PostgreSQL.

    1. Test the HTTP contract
    2. Isolate database tests
    3. Test migrations and constraints
    4. Use Testcontainers for PostgreSQL
    5. Check your understanding: integration tests
  4. Browser tests

    Exercise user journeys with Playwright locators, web-first assertions, and traces.

    1. Install Playwright
    2. Locate elements by role
    3. Wait for observable state
    4. Debug with traces
    5. Check your understanding: browser tests
  5. Reliability and CI

    Use coverage, CI stages, k6 thresholds, and a maintainable test ownership model.

    1. Use coverage as a map
    2. Build a CI test pipeline
    3. Add a k6 smoke test
    4. Finish the testing strategy
    5. Check your understanding: reliability and ci