unit testing js = sqlsat 324
DESCRIPTION
Unit testing JavaScript - August 2, 2014 - SQL Sat 324TRANSCRIPT
![Page 1: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/1.jpg)
JavaScript Testing—Technically not a number…
Justin Obney, Front-End Dev
![Page 2: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/2.jpg)
Gone are the days of old
![Page 3: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/3.jpg)
Any application that can be written in JavaScript, will be written in JavaScript -- Atwood’s Law
JS is everywhere
![Page 4: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/4.jpg)
That no one thinks they need to actually learn how it works.
Looks like C or Java… How hard could it be?
JavaScript is so approachable
![Page 5: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/5.jpg)
• The old way• Frameworks• The lies• Where to start• Tooling• Who knows?
The Agenda
![Page 6: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/6.jpg)
“Whenever you are tempted to type something into a print statement or a debugger expression, write it as a test instead.” —Martin Fowler
When do I write a test?
![Page 7: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/7.jpg)
Testing Frameworks
![Page 8: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/8.jpg)
•A unit test is code that executes part of your production code with an expectation on the result.
•Unit vs. Integration•Mocking & Stubbing
•Vocabulary
![Page 9: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/9.jpg)
But testing is hard…
![Page 10: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/10.jpg)
But the DOM
![Page 11: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/11.jpg)
Tooling
TEST’EM
![Page 12: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/12.jpg)
I see you are on a Mac… But what about Windows?
![Page 13: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/13.jpg)
But does it scale?
![Page 14: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/14.jpg)
In closing
![Page 15: Unit testing JS = SQLSat 324](https://reader033.vdocuments.site/reader033/viewer/2022061218/54b6c7084a79599f728b45af/html5/thumbnails/15.jpg)