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.

SkładQA #3 - Contract Testing, M. Bryła

346 views

Published on

Mateusz Bryła Presentation from SkładQA #3, march 2018, Kraków.

Published in: Software
  • Be the first to comment

  • Be the first to like this

SkładQA #3 - Contract Testing, M. Bryła

  1. 1. SkładQA #3 Kraków, 2018 - Mateusz Bryła
  2. 2. Contract Testing
  3. 3. Agenda - Baseline - Contract - Contract Testing - Why (not)? - Tools - Example
  4. 4. Baseline
  5. 5. Interface request response consumer producer
  6. 6. Interfaces within a service module 3module 2 module 5 (third party) module 1 module 4 module 6 (third party)
  7. 7. Partial interface producer consumer 2 consumer 1 consumer 3 request A - response A request B - response B request B - response B request A - response A
  8. 8. Microservices service 1 service 3 service 5 service 4 service 2
  9. 9. Microservices - 3P service 1 service 3 service 5 service 4 (third-party) service 2
  10. 10. Contract
  11. 11. Interface request response consumer producer
  12. 12. Contract consumer producer when request: HTTP GET /echo/hello then response: HTTP 200 { “echo”: “hello” }
  13. 13. Contract Testing
  14. 14. Unit Tests module 3 (test double) module 2 (under test) module 5 module 1 (test double) module 4 module 6
  15. 15. Integration Test service 1 (test double) service 3 (under test) service 5 (test double) service 4 (test double) service 2 (test double)
  16. 16. Single integration service 1 service 3 (under test) service 5 service 4 (test double) service 2
  17. 17. Single integration - sideways ;) service 3 (under test) service 4 (test double)
  18. 18. Contract test service (under test) service when request: HTTP GET /echo/hello then response: HTTP 200 { “echo”: “hello” } tested against
  19. 19. tested against Contract Test when request: HTTP GET /echo/hello then response: HTTP 200 { “echo”: “hello” } service (under test) service
  20. 20. Single integration with third party - test double service (under test) service (test double)
  21. 21. Single integration with third party - sandbox service (under test) service (sandbox)
  22. 22. Contract test - third party service (under test) service (sandbox) when request: HTTP GET /echo/hello then response: HTTP 200 { “echo”: “hello” } tested against
  23. 23. Contract test - third party service (under test) service (sandbox) when request: HTTP GET /echo/hello then response: HTTP 200 { “echo”: “hello” } tested against
  24. 24. Why (not)?
  25. 25. Integration Test service 1 (test double) service 3 (under test) service 5 (test double) service 4 (test double) service 2 (test double)
  26. 26. Single integration service 1 service 3 (under test) service 5 service 4 (test double) service 2
  27. 27. Single integration with third party - test double service (under test) service (test double)
  28. 28. Single integration with third party - sandbox service (under test) service (sandbox)
  29. 29. Partial interface producer consumer 2 consumer 1 consumer 3 request A - response A request B - response B request B - response B request A - response A
  30. 30. Contract test - third party service (under test) service (sandbox) when request: HTTP GET /echo/hello then response: HTTP 200 { “echo”: “hello” } tested against
  31. 31. Tools
  32. 32. Spring Cloud Contract https://cloud.spring.io/spring-cloud-contract/ Pact https://docs.pact.io/
  33. 33. Example
  34. 34. Java - shared contract https://github.com/mbryla/contract-testing
  35. 35. Should we do it?
  36. 36. Q / A

×