How to Start Unit-testing
summary
Shows how to begin unit testing JavaScript using the Mocha test framework, running tests in the console and using assertion libraries to check behavior. Recommends starting by writing tests for existing code before moving to TDD, and moving UI behavior into plain data structures so tests compare arrays/objects rather than the DOM; demonstrates the approach with a button-panel example to make tests simple, fast, and reliable.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 4:03What testing is and why
- 6:31Testing types and levels
- 9:00JavaScript test basics
- 12:17Test file structure
- 15:32Running tests
- 18:25Mocha framework
- 24:28How to test code
- 25:31TDD approach
- 32:14Testing tips
- 38:41Summary
related talks
45mAutomated Testing JavaScript
42mSurviving the JS Testing Tools Jungle
37mTesting in the Node.js World
42mTest-Driven Development in Javascript
45mWriting Tests That Don't Suck: TDD in JavaScript
25mMaking JavaScript Tests Fast, Easy, and Friendly
27mAutomated Testing for the Modern Web
47mPractical Testing with JavaScript
