Introduction
Why testing matters, the testing pyramid, cost of bugs, coverage as a metric, and a tooling overview for JavaScript/TypeScript and Java projects.
Unit Testing (JS/TS)
Setting up Jest and Vitest, writing describe/it/test blocks, using expect matchers, lifecycle hooks, and running your test suite.
Unit Testing (Java)
JUnit 5 setup with Maven and Gradle, @Test, lifecycle annotations, Assertions, @DisplayName, @Nested, and parameterised tests.
Mocking (JS/TS)
jest.fn(), jest.spyOn(), jest.mock() for modules, clearing and resetting mocks, mocking fetch and axios, and testing async code.
Mocking (Java)
Mockito setup, @Mock and @InjectMocks, when().thenReturn(), verify(), ArgumentCaptor, mocking exceptions, and spy objects.
Integration Testing
What makes a test an integration test, testing database interactions, testing HTTP endpoints with Supertest and MockMvc, and Docker-based testing with Testcontainers.
TDD
The red-green-refactor cycle, when TDD makes sense, a worked example building a shopping cart in both TypeScript and Java, and common TDD pitfalls.
React Component Testing
React Testing Library setup, render/screen/fireEvent/userEvent, querying by role and text, testing forms, and testing components that fetch async data.
Snapshot & Visual Testing
Jest snapshot testing pros and cons, updating snapshots, when to use them, and an introduction to Storybook for visual component testing.
E2E Testing (Playwright)
Playwright setup, writing your first test, page navigation, clicks, form fills, selectors, headless execution, traces and screenshots on failure, and CI integration.
Test Coverage
Coverage metrics (line, branch, function), configuring Istanbul and JaCoCo, setting thresholds, what good coverage means, and collecting coverage in CI.
Practice Project
End-to-end exercise — build and test a small TypeScript utility library with Vitest (unit and integration tests), full coverage report, and GitHub Actions CI.