Testing

What is an assertion?

Boolean expression written for evaluating a specific software portion.

What is code coverage?

How much code is executed when you run the tests.

What is a Spy?

Tracks how many times a function is called.

What is a Mock?

Similar to a spy, but has the ability to capture the parameters passed into the function and test the return value. You want to cleanup after use.

What is Monkey Patching?

Dynamically replacing functions or objects properties during test to use data you specify.

What is a Stub?

A replacement for data or functionality in your app that returns a value you predefine.

What is a Test Double?

Generic term for the Stub / Spy / Mock combination

What are the basic types of testing?

  • Static testing: catch typos and type errors
  • Unit: verify individual, isolated parts works as expected
  • Integration: verify that several units work together in harmony
  • End-to-end (functional testing, user acceptance): a helper robot that behaves like the user clicks around and fills in forms

What to test?

  • What is the worst part of the application to break? (i.e. checkout process)
  • What are untested parts of the code related to this functionality
  • Choose an interaction and write a step by step guide for manual testing
  • Automate
  • Repeat

Frameworks:

  • Jest
  • Selenium
  • Pupeteer
  • node-mock
  • eslint
  • json-schema-faker
  • json-server
  • supertest
  • superagent
  • prettier
Last updated on 20th Aug 2019