TDD With Ember.js

TDD With Ember.js

2956e2cd2664630aa968b92bbb645f2f?s=128

Kerrick Long

March 06, 2014
Tweet

Transcript

  1. Test Driven Development

  2. Kerrick Long Things I make and do Where to find

    me online twitter.com/KerrickLong github.com/Kerrick Lead Front-end Developer at Second Street KerrickLong.com www. meetup.com/STLEmber
  3. Why TDD?

  4. Outside-In

  5. Integration Tests Unit Tests then

  6. Red Green Refactor

  7. Green Refactor

  8. Test-Driven Design

  9. How?

  10. Integration Test

  11. Integration Test

  12. Integration Test Unit Test

  13. Integration Test Unit Test

  14. Integration Test Unit Test Unit Test Unit Test

  15. Integration Test Unit Test Unit Test Unit Test

  16. Integration Test Unit Test Unit Test Unit Test Unit Test

  17. Integration Test Unit Test Unit Test Unit Test Unit Test

  18. Integration Test Unit Test Unit Test Unit Test Unit Test

  19. Integration Test Unit Test Unit Test Unit Test Unit Test

  20. Integration Test Unit Test Unit Test Unit Test Unit Test

  21. Tooling

  22. Karma Test Runner

  23. None
  24. None
  25. None
  26. None
  27. QUnit.js

  28. Assertions

  29. QUnit.assert.ok( makeBoolean() ) Assertions

  30. QUnit.assert.equal( makeTen(), '10' ) Assertions

  31. QUnit.assert.strictEqual( makeTen(), 10 ) Assertions

  32. QUnit.assert.deepEqual( makeObject(), { foo: ‘bar’, baz: 10 } ) Assertions

  33. QUnit.assert.propEqual( makeObject(), { foo: ‘bar’, baz: 10 } ) Assertions

  34. QUnit.assert.throws( function() { throwError() }, ‘Example Thrown Error’ ) Assertions

  35. Ember Test Helpers

  36. App.rootElement = ‘#qunit-fixture’ App.setupForTesting() App.injectTestHelpers(QUnit)

  37. QUnit.visit(‘/posts’)

  38. QUnit.find(‘.add’, ‘.list’)

  39. QUnit.fillIn( ‘.name’, ‘Kerrick’ )

  40. QUnit.click(‘.submit’)

  41. QUnit.keyEvent( ‘.wysiwyg’, ‘keypress’, 30 )

  42. QUnit.visit(‘/posts/new’) .fillIn(‘.name’, ‘Hello’) .click(‘.submit’) .then(function() { QUnit.assert.ok(true) })

  43. QUnit.visit(‘/posts/new’) QUnit.fillIn(‘.name’, ‘Hi’) QUnit.click(‘.submit’) QUnit.andThen(function() { QUnit.assert.ok(true) })

  44. QUnit.visit(‘/posts/new’) QUnit.fillIn(‘.name’, ‘Hi’) QUnit.click(‘.submit’) QUnit.andThen(function() { QUnit.assert.ok(true) })

  45. Integration
 Tests

  46. Controller Unit Tests

  47. Component Unit Tests

  48. Mixin Unit Tests

  49. Component Unit Tests