Hands On Workshop: The Art of Unit Testing & TDD in Modern JavaScript
with Roy Osherove
The Problem
Unit testing, done badly, can hurt your project more than it helps. In some cases, it may lead to project schedule delays, and unhappy developers due to huge maintenance problems. But when unit testing is done right, it can help the project and developers’ confidence immensely. The challenge is - how do you do it in a way that is helping, rather than hurting your project?
Objective
Specifically designed for the new age of modern JavaScript in 2020, In this coding-packed training workshop we will learn essential test driven skills and techniques for writing unit tests in a readable, maintainable and trustworthy fashion, so that we can feel more confident in our code, make it simpler, and save ourselves time in debugging and maintaining our code base. we will also look at some code design issues that hurt testability.
Learn how to write readable, maintainable, trustworthy unit tests using Javascript and node.js,
Learn how to refactor code, and SOLID design concepts.
Learn the principles of Test Driven Development, and develop new features using TDD.
Learn how to Pair Program, and experience it throughout the course
Learn about mocks, stubs, spies & fakes, and the difference between them
Learn about testing frameworks such as jest and Jasmine, and isolation (mocking) frameworks like sinon & jest mocks.
Pre-Requisites
The course will benefit both backend (node.js) developers and frontend (Angular, React, Vue etc..) developers with at least a year’s experience developing with JavaScript ES2015 syntax knowledge
No knowledge of typescript is required, but drills can be executed in typescript if you find it useful.
VS Code, IntelliJ, Webstorm or other JS enabled IDEs with JavaScript or Typescript enabled plugins
JS ES2015 syntax knowledge
Agenda
Day 1: Beginnings (09:00-16:00)
Units, entry points & exit points.
The first unit test & a continuous testing environment
Jest basics & Drills
Writing readable, maintainable tests
Test Driven Development Introduction
String Calculator,Password Verifier Kata Drills
Value based, State Based and Interaction Based Tests
Drills
Day 2: Mocks & Stubs (09:00-16:00)
Understanding Fakes, Spies Mocks and Stubs
Hand Written Fakes, Stubs and Mocks
Faking Time & Drills
Faking other dependencies & Drills
Jest.fn, jest.spyOn and other creatures
Drills, Drills, Drills
Day 3: Diving Deeper (09:00-16:00)
Async in Tests & Drills
Legacy Refactorings
Faking whole modules & Drills
Unit Testing Good Practices
Code Review Drills