Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

8 - Javascript unit testing framework


Published on

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

8 - Javascript unit testing framework

  1. 1. JavaScript Unit Testing Hanoi PHP Day 2010 @hoatle
  2. 2. JavaScript Unit Testing Framework <ul><li>Presenter: Hoat Le Van (aka hoatle) </li></ul><ul><li>eXo Social Team Leader </li></ul><ul><li>Hanoi PHP Day: </li></ul><ul><ul><li>2008: attendee </li></ul></ul><ul><ul><li>2009: Advanced JavaScript Techniques </li></ul></ul><ul><ul><li>2010: JavaScript Unit Testing Framework </li></ul></ul><ul><li>Work mostly with Java but have much interest in JavaScript </li></ul><ul><li>Twitter: @hoatle </li></ul>
  3. 3. Agenda <ul><li>JavaScript </li></ul><ul><li>Unit Testing </li></ul><ul><li>JavaScript Unit Testing Frameworks </li></ul><ul><li>Fun time for coding </li></ul>
  4. 4. JavaScript
  5. 5. What is JavaScript? <ul><li>An implementation of the ECMAScript language standard </li></ul><ul><li>The King of client-side scripting for web </li></ul><ul><li>A prototype-based object-oriented scripting language </li></ul><ul><li>“ The world's most misunderstood programming language” (Douglas Crockford) </li></ul><ul><ul><li>The Name </li></ul></ul><ul><ul><li>Bad books </li></ul></ul><ul><ul><li>Amateurs </li></ul></ul><ul><ul><li>Object Oriented? </li></ul></ul>
  6. 6. Unit Testing
  7. 7. What is Unit Testing? <ul><li>Units of source code are tested </li></ul><ul><li>Written and run by developers to ensure that code meets its design and behaves as intended and expected </li></ul><ul><li>Commonly automated </li></ul><ul><li>Extreme Programming uses the creation of unit tests for test-driven development </li></ul>
  8. 8. Samples (Java - JUnit)
  9. 9. Samples (Java - JUnit)
  10. 10. Samples (JavaScript - QUnit)
  11. 11. Samples (JavaScript - QUnit)
  12. 12. Test Driven Development (TDD) <ul><li>Writes a failing automated test case that defines a desired improvement or new function </li></ul><ul><li>Implements code to pass that test </li></ul><ul><li>Finally refactors </li></ul>
  13. 13. Test Driven Development (TDD) (wikipedia)
  14. 14. Unit Testing Benefits <ul><li>To isolate each part of the program and show that the individual parts are correct </li></ul><ul><li>Facilitates change </li></ul><ul><li>Documentation </li></ul><ul><li>Design </li></ul>
  15. 15. JavaScript Unit Testing Frameworks
  16. 16. JavaScript Unit Testing Frameworks
  17. 17. Fun time for JavaScript Unit Testing and Q&A?