2. How Do You Know Your
Software Works?
• Click testing
• Console logging
• Breakpoints
3. What Are Some Challenges
To Manual Testing
• Time consuming
• Error prone
• Are you testing all code paths?
• Unanticipated side effects
4. Hello, Automated Testing
• No, it’s not really a cure-all
• But it will go a long way to
identify and avoid bugs
http://www.cedricstudio.com/2014/01/sketchbook-update-snake-oil-salesman/
5. Side Note: Software Bugs
• Anyone know where the term “bug” came from
Admiral Grace Hopper
6. What Is Automated Testing
• Code written to test your code
• Isn’t that twice as much code
• Isn’t that how SkyNet started
7. Testing as a Design Practice
• Test Driven Development (TDD)
• Write the test before you write the
code (Red)
• Write just enough code to make
test pass (Green)
• Rework the code to make it more
readable, maintainable (Refactor)
https://www.safaribooksonline.com/library/view/modern-c-programming/
9781941222423/images/RedGreenRefactor.png
9. Anatomy of a Test
• Most test frameworks use a domain specific
language (DSL) to write the test
https://s-media-cache-ak0.pinimg.com/236x/5e/83/
b2/5e83b27ccb29f39c34c40a97096012b5.jpg
10. Enough Talking
(Let’s Write Some Code)
• First time I came in to TA, you were all building a
calculator in JavaScript
• We’ll use a testing framework called Mocha
• https://mochajs.org/
• https://github.com/mdenomy/intro-to-mocha-testing