Angular Testing von A bis Z

Angular Testing von A bis Z

AngularDays 2017 in Berlin - Testing from A to Z

Fb89953d3a1b1fcb862a186585c37c25?s=128

Fabian Gosebrink

October 11, 2017
Tweet

Transcript

  1. A -Z Testing

  2. Fabian Gosebrink

  3. None
  4. None
  5. Agenda Exploring the Tools Unit Testing with Angular Integration Testing

    with Angular End 2 End Testing with Angular Test Driven Development
  6. Testing

  7. UnitTesting

  8. ShallowTesting

  9. INtegrationTesting

  10. End 2 End Testing

  11. Strategies

  12. SmallesT as Possible

  13. REadable

  14. Do Not Mock...

  15. ...That Often

  16. Test Driven

  17. Explore the tools

  18. Explore the tools Protractor Jasmine Karma

  19. Jasmine • Behaviour Driven Development • Fast

  20. None
  21. None
  22. None
  23. Some Jasmine Matchers expect(array).toContain(member); expect(mixed).toBeDefined(); expect(mixed).toBeFalsy(); expect(mixed).toBeNull(); expect(mixed).toBeTruthy(); expect(mixed).toBeUndefined(); expect(mixed).toEqual(mixed);

    expect(mixed).toMatch(pattern); expect(number).toBeCloseTo(number, decimalPlaces); expect(number).toBeGreaterThan(number); expect(number).toBeLessThan(number); expect(number).toBeNaN(); expect(spy).toHaveBeenCalled(); expect(spy).toHaveBeenCalledTimes(number); expect(spy).toHaveBeenCalledWith(...arguments);
  24. None
  25. None
  26. Skip Tests

  27. Karma • Test runner • Spawns browser & runs tests

    • Also on CommandLine
  28. None
  29. None
  30. Protractor • End-to-end test framework • Runs in a real

    browser • Test like a user
  31. Testing

  32. Component.ts

  33. Component.spec.ts

  34. AngularCLI

  35. None
  36. None
  37. None
  38. ARRANGE ACT ASSERT

  39. None
  40. Testing Pipes

  41. None
  42. Testing Services

  43. None
  44. None
  45. None
  46. Testing Services ASYNC

  47. None
  48. None
  49. None
  50. Code...

  51. Testing Routing

  52. None
  53. None
  54. Testing Components

  55. Code...

  56. None
  57. https://github.com/FabianGosebrink/AngularDays-2017 https://offering.solutions https://swissangular.com @FabianGosebrink

  58. Links https://medium.com/google-developer-experts/angular-2-testing-guide-a485b6cb1ef0 https://blog.thoughtram.io/angular/2016/12/27/angular-2-advance-testing-with-custom- matchers.html https://blog.nrwl.io/essential-angular-testing-192315f8be9b https://vsavkin.com/three-ways-to-test-angular-2-components-dcea8e90bd8d https://medium.com/letsboot/angular-end-to-end-testing-c3b9950fdd41 https://developers.livechatinc.com/blog/testing-angular-2-apps-routeroutlet-and-http/ https://jasmine.github.io/edge/introduction.html#section-Included_Matchers