Successfully reported this slideshow.
Your SlideShare is downloading. ×

Unit testing JS = SQLSat 324

More Related Content

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Unit testing JS = SQLSat 324

  1. 1. JavaScript Testing— Technically not a number… Justin Obney, Front-End Dev
  2. 2. Gone are the days of old
  3. 3. Any application that can be written in JavaScript, will be written in JavaScript -- Atwood’s Law JS is everywhere
  4. 4. 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
  5. 5. • The old way • Frameworks • The lies • Where to start • Tooling • Who knows? The Agenda
  6. 6. “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?
  7. 7. Testing Frameworks
  8. 8. •A unit test is code that executes part of your production code with an expectation on the result. •Unit vs. Integration •Mocking & Stubbing •Vocabulary
  9. 9. But testing is hard…
  10. 10. But the DOM
  11. 11. Tooling TEST’EM
  12. 12. I see you are on a Mac… But what about Windows?
  13. 13. But does it scale?
  14. 14. In closing
  15. 15. Thank You justinobney@gmail.com twitter.com/justinobney github.com/justinobney apply@envoccareers.com

Editor's Notes

  • Who am I

    Envoc
    .Net beginning
    now they pay me to write JavaScript
    The web is changing rapidly
    The good old days
    WEB FORMS:
    post a form
    let the server build 1/2 MB or html
    and then send it back to the client
    to change a radio button …
    Cue magic
  • Some of you may still live there...
    Get out now…
    JavaScript on rise
  • Atwood’s Law
    CodingHorror
    StackOverflow
    it runs everywhere
    The server
    Mobile apps
    TVs?
    PS4?
    Heard of the web.. it is here to stay.
  • 0.1 + 0.2
  • console.log
    has the nasty risk of introducing bugs all on its own.
    enter dev tools (`debugger;`)
  • QUnit
    older, more support
    mocha
    can drop in any* assertion library
    jasmine
    headless browser support
    built in spies & mocks
  • Vocabulary
    A unit test is code that executes part of your production code with an expectation on the result.
    Unit vs integration
    unit - should be able to trust they should all be green
    integration - sometimes fail due to circumstance/environment
    Mocking and stubbing
    Mocks - you expect to assert against value (1 per test)
    Stubs - fake calls out. can have many

  • ----- Meeting Notes (4/8/14 20:43) -----
    Gmail, Facebook, Twitter, Azure Management Portal
    Models, Controllers, Services, Smart Caching, DI
    -- All things that can live in the client now

  • ----- Meeting Notes (4/8/14 20:48) -----
    Most of the tooling you will find will run on NodeJS
    Node has made Windows a first class citizen.
    You can integrate it into most of your existing CI servers.
    The only thing stopping you is you.

  • This is not library code.
    There is very little DOM manipulation going on here (SPA).
    This is application logic.

×