Skip to content

Instantly share code, notes, and snippets.

@RyanParsley
Last active January 29, 2016 16:09
Show Gist options
  • Select an option

  • Save RyanParsley/9fb89df421b061bc9031 to your computer and use it in GitHub Desktop.

Select an option

Save RyanParsley/9fb89df421b061bc9031 to your computer and use it in GitHub Desktop.
Notes for a Frontend Testing Lunch and Learn

name: Frontend Testing Redux class: middle, center

Frontend Testing Redux:

The duxening

Jan 29, 2016


Two basic kinds of tests

  1. Unit testing (Faster, logic tested in isolation from the DOM)
  • When this "function X" is run with "Y parameters", I expect "Z results"
  1. End to End testing (Robot QA Friend that click around your app)
  • When a user clicks on "element X", I expect "element Y" to change in the following way.

Previously on Adventures in frontend testing: http://gistdeck.github.io/RyanParsley/e9733f8d472ae7778346#1

What have I been up to with testing


Benefits

  • Less noisy/distracting that a "suite" of console.logs
  • Less embarassing than a human pointing out my many faults
  • Semi-automatic code documentation
  • Regression coverage

Challenges

  • With unit testing, you need to understand injection and how digest works more than simply using angular (this is a feature not a bug)
  • With E2E testing, it's... non-trivial to get selenium running on the server in a reliable way

TDD?

you are not ready

When do I write a test

  • When I want/need persistant console.log messages
  • When the "API" settles down a bit
  • When I fear I'm about to break something

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment