These slides are licensed using:

Testing JavaScript

Kuba Waliński

Kuba Waliński

  • kubawalinski@gmail.com
  • @kubawalinski
  • github.com/kubawalinski
  • blog.kubawalinski.com

JavaScript a few years ago

JavaScript today

e2e acceptance tests

  • usually created by QA staff
  • fragile
  • quite slow
  • still better than a 100 page long acceptance document

Linting

  • JSLint, JSHint, ESLint
  • Able to catch some problems early
  • Choose your own rules

Why unit tests?

Unit testing is boring?

"Unit testing is like sex - if it's not fun, you're doing it wrong"

Tightening the feedback loop

  • after UAT, release - users
  • after finishing a feature - qa staff
  • after each commit/push - ???
  • after each code change - ???

Tests first?

or code first?

Explore the unknown

Validation of your hypotheses

Tests as documentation

always up to date

Don't overdo it

chasing coverage considered harmful

Make it easy to test

and hard to be wrong

  • automate all the things?
  • treat warnings as errors

Tools don't matter

just start doing it

Demo time :)

Useful links

Why unit tests?

  • tighter feedback loop
  • explore the unknown
  • validate your hypotheses
  • always up-to-date documentation
  • reassure yourself that it all works

Seriously, you should start testing that JS code

Thanks!

Made with Slides.com