Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Unit vs. Integration Tests

1 439 vues

Publié le

The slides of my session "Unit vs. Integration Tests" I gave at our Softwerkskammer Meetup Munich.

Abstract:
Unit and integration test fan boys have been fighting against each other since the early days of TDD. Nevertheless in the last years the test pyramid has become the common sense strategy for automated tests synthesizing both approaches in an economic ratio. Unfortunately in practice the vague and abstract concept leaves us alone with a lot of remaining questions.

I will start the session introducing the test pyramid strategy and the strengths and weaknesses of the different kinds of tests followed by implementation approaches valuable for real life. Then we will split up into small groups and discuss there what in our current projects works well for us and work together on how we can approach remaining challenges. In the end we will come together again and exchange our solutions in the full audience.

Publié dans : Logiciels
  • Soyez le premier à commenter

Unit vs. Integration Tests

  1. 1. Unit vs. Integration Tests Softwerkskammer Meetup Munich @codecentric 18.06.2015 David Völkel @davidvoelkel
  2. 2. Unit vs. Integrated Tests Isolated integratedvs.
  3. 3. Which do you prefer? Isolated Integrated 1 2 3 4 5
  4. 4. Agenda ● Theory ● Unit vs. Integration Tests ● Test Pyramid ● How to achieve it ● Workshop ● What works well in our projects? ● Hardest challenges? ● How to address them? ● Another beer
  5. 5. Expensive Integrated Tests Isolated Integrated Creation & Maintenance cheap expensive Feedback fast slow Finding Errors easy difficult Fragility minimal high Significance for User medium high 4 n + m n * m
  6. 6. Unit under test? Isolated Integrated Strengths Complex logic („combinatorial explosion“), conditionals, breadth Integration, data flow, depth
  7. 7. Test Pyramid UI Service Unit DegreeofIntegrationBy Mike Cohn
  8. 8. No: Test Pyramids!?! By Mike Cohn
  9. 9. ? ? Unit
  10. 10. Orthogonal decomposition By Mike Cohn . IntegratedTests Isolated Tests &
  11. 11. Business Dimension Acceptance Tests == UI-Tests? Inspired through "the testing iceberg“ by Seb Rose / Matt Wynne Acceptance Tests Technical Tests Business Domain DegreeofIntegration .
  12. 12. Split up Acceptance Tests Acceptance Tests UI Domain Rules
  13. 13. Example Email Validation N x integrated web tests Input Output „valid@email.de“ „Email OK“ „mail.without@tld“ „Email invalid“ „mail.without.at.de“ „Email invalid“ „@without-user.de“ „Email invalid“ … valid
  14. 14. Example Email Validation 1 x integrated web tests N x isolated tests valid Input Output „valid@email.de“ „Email OK“ „mail.without@tld“ „Email invalid“ „mail.without.at.de“ „Email invalid“ „@without-user.de“ „Email invalid“ …
  15. 15. UI Test Pyramid UI Test != End2End Tests E2E Compo nent Unit DegreeofIntegration
  16. 16. (UI) End2End Tests Fully integrated down to the backend for • backend interaction • few logic (CRUD) • simple workflows • hardly testable legacy UI E2E Compo nent Unit Back- end
  17. 17. Gmail Example E2E Compo nent Unit Minimal workflow
  18. 18. UI-Layer component test ● testability required ● fat client ● SPA + REST ● server-side rendering? E2E Compo nent Unit UI Mock Back end
  19. 19. UI-Layer for • session status • complex UI workflows • workflows with few backend- interaktion E2E Compo nent Unit UI Mock Back end
  20. 20. Gmail Example E2E Compo nent Unit Mail editing
  21. 21. UI Unit Tests for complex logic value rendering MVP: Presenter logic Address example: „D-80687, München, Elsenheimerstraße 55a“ „-, München, Elsenheimerstraße 55a“? E2E Compo nent Unit UI
  22. 22. Resumee UI Service Unit Test Pyramid • Integrated Tests: Integration & Depth • Isolierte Tests: Logic & Breadth Orthogonal Decomposition • Split up Acceptance Tests • Business Rules • UI • E2E, UI Layer, UI Unit Tests
  23. 23. Workshop Agenda ● Round 1: current state in your project ● Successful solutions? ● Hardest challenges? ● Show & tell ● Round 2 ● how can we improve? ● Show & tell ● Retrospective
  24. 24. Retrospective
  25. 25. License Creative Commons Attribution-ShareAlike 3.0 https://creativecommons.org/licenses/by-sa/3.0/de/

×