benwilhelm / tdd-taster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TDD Taster

Note: This is part of a free monthly series of webinars for junior devs.
https://benwilhelm.com/webinars

Thanks for checking out my webinar on Test-Driven Development! This repo contains the code from the examples that I showed, plus some additional resources for studying TDD on your own.

Webinar Video

The video from the webinar can be found here. This is the unedited video for the moment. The webinar begins around 4m22s

Example code

Code for the examples can be found in the example-fizzbuzz/ and example-invoice/ directories. Each directory contains its own README with instructions for installing dependencies and running the code.

Further resources

I was barely able to scratch the surface of this subject in the hour that I had to present, so here are some articles that I think would be worth your time to read as you continue to study on your own.

Overview of TDD as a methodology

Test-Driven Development - What is it and how do you use it? - This is a good overview of how to use a TDD workflow, agnostic of any language or tooling.

Test-Driven Development is Not About Bugs - A good explanation that TDD is not about finding bugs in your code, it's about accurately defining the behavior of your code. Bugs are by definition unforeseen, and therefore it's impossible to write tests for every possible bug that could occur. But, well-tested code is usually much easier to debug because you have an unambiguous description of what the code should be doing.

Kinds of tests: Unit, Integration, Functional, E2E, etc

There is no clear definition of any of these terms. Anyone who claims to be able to define them unabiguously is lying to you. That said, here are some good sources to understanding how the terms are commonly used, and what their roles are.

What is an integration test exactly?

The testing pyramid, and for a counter-argument Write Tests. Not too many. Mostly Integration, and for a counter-counter-argument Integration Tests are a Scam

Types of *DD

If you're interested, here's a good breakdown of Test-Driven Development vs Behavior-Driven Development vs Acceptance-Test Driven Development. Short answer is that the test-first mentality is consistent through all of them, but what differs is the format and point of view of the tests.

JavaScript testing frameworks and assertion libraries

I used Mocha and Chai in my examples, but there are several others available.

Jest and Jasmine both ship with assertion libraries built in.

Node.js has a built-in assert module that is very capable as well.

Here's a decent comparison of some popular testing frameworks.

About


Languages

Language:JavaScript 74.8%Language:HTML 22.2%Language:CSS 3.0%