Your SlideShare is downloading. ×
Testing javascript
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Testing javascript

1,323
views

Published on

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,323
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
10
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Testing JavaScript with Jasmine
  • 2. Why should we test JavaScript?
  • 3. How many times have youchanged something in JavaScript
  • 4. Only to break something else?
  • 5. JavaScript = Production Code!
  • 6. Which means, we need to treat it with respect
  • 7. And, preserve the ability to
  • 8. change
  • 9. fix
  • 10. clean
  • 11. and refactor our JavaScript code
  • 12. Without fear of breaking something
  • 13. Testing is especially important when external factors can affect how our code functions
  • 14. What makes a good test?
  • 15. Think F.I.R.S.T
  • 16. Fast
  • 17. IndependentTests should not depend on each other.
  • 18. RepeatableAlways the same results, regardless of environment.
  • 19. Self-Validating Pass or FailNo manual evalutation.
  • 20. TimelyWrite tests before production code.
  • 21. Let’s look at an example.A random function for rolling a die.
  • 22. What’s wrong here?
  • 23. How do we normally debug JavaScript?
  • 24. Let’s forget we even mentioned that…
  • 25. So… we have this buggy code.
  • 26. What do we do about it?
  • 27. Write a failing test
  • 28. Then Run the test to see it fail
  • 29. SpecRunner.html
  • 30. Squash the bug
  • 31. Success!
  • 32. Add more tests
  • 33. Win!Testing = Documentation!
  • 34. Remember…
  • 35. When you find yourself wanting to do this.
  • 36. Write a test instead!
  • 37. Questions?