Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[AppDevCon] Ogres, onions and layers – story about tests at scale

[AppDevCon] Ogres, onions and layers – story about tests at scale

We want to take you on the journey. Journey through different layers of tests in an iOS app that’s used by more than half million unique users per month. Get to know the way we test it, step by step, layer by layer. We start with advanced code static analysis, continue with mutation, snapshot and functional tests. We carry on with continuous delivery, A/B tests and usability tests. We want to share with you which tools we are using and what testing practices we believe in. This is a true story driven by problems we experience at work, presented from tester’s and developer’s perspective.

Aleksander Grzyb

March 16, 2018
Tweet

More Decks by Aleksander Grzyb

Other Decks in Programming

Transcript

  1. 1

  2. Ogres, onions and layers – story about tests at scale

    Ewa Ludwiczak & Aleksander Grzyb AppDevCon 2018 Amsterdam
  3. 7 Static analysis Mutation testing Snapshot tests Functional tests Continuous

    delivery Phased release A/B tests Usability tests Problem - test solution
  4. 8 1. Crash on production Static analysis 2. Evergreen unit

    test Mutation testing 3. Testing views Snapshot tests 4. Change management Functional tests 5. Is RC is working? Continuous delivery 6. Laboratory conditions Phased release 7. Decision making A/B tests 8. How users use our app? Usability tests Problem - test solution
  5. 12 Problem 1: Crash on production caused by force unwrapping

    Solution: SwiftLint https://github.com/realm/SwiftLint
  6. 13 Problem 1: Crash on production caused by force unwrapping

    Solution: SwiftLint OFFER LISTING SEARCH CART ... HOME ALLEGRO
  7. 15 Problem 1: Crash on production caused by force unwrapping

    Solution: SwiftLint too short constant name
  8. 16 Problem 1: Crash on production caused by force unwrapping

    Solution: SwiftLint too long variable name too short constant name
  9. 17 Problem 1: Crash on production caused by force unwrapping

    Solution: SwiftLint too long variable name too short constant name
  10. 18 Problem 1: Crash on production caused by force unwrapping

    SwiftFormat + SwiftLint https://github.com/nicklockwood/SwiftFormat
  11. 19 Problem 1: Crash on production caused by force unwrapping

    SwiftFormat + SwiftLint OBSERVED LISTING OFFER CART ... HOME ALLEGRO
  12. respect modular architecture 21 Problem 1: Crash on production caused

    by force unwrapping Solution: SwiftLint remarks
  13. respect modular architecture run locally after each build 22 Problem

    1: Crash on production caused by force unwrapping Solution: SwiftLint remarks
  14. respect modular architecture format obvious rules, lint less trivial run

    locally after each build 23 Problem 1: Crash on production caused by force unwrapping Solution: SwiftLint remarks
  15. respect modular architecture format obvious rules, lint less trivial run

    locally after each build 24 Problem 1: Crash on production caused by force unwrapping Solution: SwiftLint remarks apply to production code and tests
  16. respect modular architecture format obvious rules, lint less trivial use

    the same versions of formatter & linter run locally after each build apply to production code and tests 25 Problem 1: Crash on production caused by force unwrapping Solution: SwiftLint remarks
  17. 26 1. Crash on production Static analysis 2. Evergreen unit

    test Mutation testing Problem - test solution
  18. 29

  19. 30

  20. 41 Problem 2: Evergreen unit tests Solution: Mutation testing remarks

    code coverage says little about test quality
  21. 42 Problem 2: Evergreen unit tests Solution: Mutation testing remarks

    code coverage says little about test quality use manual mutation in non-trivial test cases
  22. code coverage says little about test quality not all mutations

    add value use manual mutation in non-trivial test cases 43 Problem 2: Evergreen unit tests Solution: Mutation testing remarks
  23. code coverage says little about test quality not all mutations

    add value use manual mutation in non-trivial test cases 44 Problem 2: Evergreen unit tests Solution: Mutation testing remarks automated mutation testing Problem 2: Evergreen unit tests Solution: Mutation testing https://github.com/mull-project/mull
  24. 45

  25. 46 1. Crash on production Static analysis 2. Evergreen unit

    test Mutation testing 3. Testing views Snapshot tests Problem - test solution
  26. and for a bigger view, one test can take over

    1 second 68 Problem 3: Testing views Snapshot tests overhead
  27. 69 Problem 3: Testing views Snapshot tests overhead OBSERVED MODULE

    LISTING MODULE OFFER MODULE CART MODULE ... HOME MODULE ALLEGRO APP
  28. quickly verify view’s layout be careful when testing large views

    enables to test accessibility 72 Problem 3: Testing views Snapshot tests remarks
  29. quickly verify view’s layout be careful when testing large views

    enables to test accessibility 73 measure your tests Problem 3: Testing views Snapshot tests remarks
  30. 74 1. Crash on production Static analysis 2. Evergreen unit

    test Mutation testing 3. Testing views Snapshot tests 4. Change management Functional tests Problem - test solution
  31. 78 Problem 4: Predicting consequences of change Solution: End-to-end UI

    tests LISTING OFFER HOME ... CART ALLEGRO SEARCH https://github.com/kif-framework/KIF
  32. 80 Problem 4: Predicting consequences of change Solution: End-to-end UI

    tests remarks separate test target flaky tests
  33. 81 Problem 4: Predicting consequences of change Solution: UI tests

    with mocked API LISTING OFFER HOME ... CART ALLEGRO SEARCH https://github.com/kif-framework/KIF
  34. 82 Problem 4: Predicting consequences of change Solution: UI tests

    with mocked API JSON files JSON scheme configuration file validation
  35. 83 Problem 4: Predicting consequences of change Solution: UI tests

    with mocked API remarks faster, more reliable UI tests
  36. 84 Problem 4: Predicting consequences of change Solution: UI tests

    with mocked API remarks faster, more reliable UI tests relatively slow test coverage progress
  37. 85 Problem 4: Predicting consequences of change Solution: UI tests

    with mocked API remarks faster, more reliable UI tests relatively slow test coverage progress tests not critical to merge
  38. 86 Problem 4: Predicting consequences of change Solution: UI tests

    improvements More bugs detected 10% comparison of 10 real API and mocked API UI test runs Less flaky tests 70% comparison of 10 real API and mocked API UI test runs
  39. 87 1. Crash on production Static analysis 2. Evergreen unit

    test Mutation testing 3. Testing views Snapshot tests 4. Change management Functional tests 5. Is RC is working? Continuous delivery Problem - test solution
  40. 93 1. Crash on production Static analysis 2. Evergreen unit

    test Mutation testing 3. Testing views Snapshot tests 4. Change management Functional tests 5. Is RC is working? Continuous delivery 6. Laboratory conditions Phased release Problem - test solution
  41. 95 Problem 6: Testing in laboratory condition ENG “After latest

    release application crashes - soft 9.0” Elen Musk
  42. 96 Problem 6: Testing in laboratory condition Elen Musk ENG

    “After latest release application crashes - soft 9.0”
  43. 98 Problem 6: Testing in laboratory condition Solution: Phased release

    https://www.smithsonianmag.com/smart-news/story-real-canary-coal-mine-180961570/
  44. 99 1. Crash on production Static analysis 2. Evergreen unit

    test Mutation testing 3. Testing views Snapshot tests 4. Change management Functional tests 5. Is RC is working? Continuous delivery 6. Laboratory conditions Phased release 7. Decision making A/B tests Problem - test solution
  45. 107 Problem 7: Decision making A/B test runs in Offer

    Comparison module OFFER LISTING SEARCH OFFER COMPARISON ... HOME ALLEGRO
  46. 108 Problem 7: Decision making Optimizely is linked to main

    app OFFER LISTING SEARCH OFFER COMPARISON ... HOME ALLEGRO A/B test runs in Offer Comparison module
  47. 115 1. Crash on production Static analysis 2. Evergreen unit

    test Mutation testing 3. Testing views Snapshot tests 4. Change management Functional tests 5. Is RC is working? Continuous delivery 6. Laboratory conditions Phased release 7. Decision making A/B tests 8. How users use our app? Usability tests Problem - test solution
  48. 116 Problem 8: Do we have the right product? “This

    app is a toy. I have nothing to say...” “Very bad. After updates, only worse not better...” Elton Johny Tejlor Swift
  49. 117 Problem 8: Does the user know how to use

    our app? Solution: Usability testing One-way mirror
  50. 119 Problem 8: Does the user know how to use

    our app? Solution: Usability testing One-way mirror
  51. 120 Problem 8: Does the user know how to use

    our app? Solution: Usability testing One-way mirror
  52. 121 1. Crash on production Static analysis 2. Evergreen unit

    test Mutation testing 3. Testing views Snapshot tests 4. Change management Functional tests 5. Is RC is working? Continuous delivery 6. Laboratory conditions Phased release 7. Decision making A/B tests 8. How users use our app? Usability tests Problem - test solution
  53. 122 Thank you for your attention! Ewa Ludwiczak Senior Software

    Test Engineer [email protected] @ewabielskapoz Aleksander Grzyb iOS Engineer [email protected] @aleksandergrzyb