Test 1, Test 2... Test 3.

testing is about code quality and documentation

WITHOUT TESTS... HOW DO YOU SLEEP AT NIGHT? —Brandon Hays

If I am going to make a change... How do you know at the end of that that you haven't broken anything?

—Toran Billups

The best kind of documentation tells you what behavior a given piece of code should have.

why test your code?

1. ensure code quality

1. ensure code quality

2. Document your code

1. ensure code quality

2. Document your code

3. Just do it

What are the different types of tests?

unit tests

fast, mocked Dependencies, repeatable, granular, Consistent

unit tests

don't make real http requests

Don't make real async requests

Don't have side effects

 

integration tests

anything that isn't a unit test...

Use both. Start with unit tests.

the usual suspects:

karma

a test execution environment

mocha

A testing framework

chai

an assertion library

Why those‽

flexibilty.

SIMPlicity.

pure JS testing first...

Angular Testing...

Quick thoughts on writing good tests...

1. Clear exceptions

2. test only one thing

Test1, Test 2... Test 3.

By Daniel Sellers

Test1, Test 2... Test 3.

  • 1,489