Pragmatic Mobile Testing Strategies

Pragmatic Mobile Testing Strategies

As software engineers, we found problems to write automated tests, this talk it's about strategies to ensure write reliable tests.

9f523401a845a29c93ff73cde4c3db2b?s=128

Erik Jhordan Rey

September 25, 2018
Tweet

Transcript

  1. Pragmatic Mobile Testing Strategies Erik Jhordan Rey Android Tech Lead

    at Segundamano erik.gonzalez@schibsted.com @ErikJhordan_Rey github.com/erikcaffrey
  2. / SCHIBSTED MEDIA GROUP Erik Jhordan Rey Passionate about write

    quality code, focused to improving the profession of software development. Android Tech Lead at Segundamano
  3. / SCHIBSTED MEDIA GROUP Presence in 30 Countries Y seguimos

    creciendo MÉXICO Colombia Chile Brasil República Dominicana LATINOAMÉRICA Noruega Suecia Finlandia Bélgica Francia ESCANDINAVIA / EUROPA Portugal Alemania Polonia España Italia Irlanda Suiza Austria Hungría Rumania Bielorrusia Reino Unido Marruecos ÁFRÍCA Túnez Malasia Indonesia Singapur Vietnam Tailandia Bangladés ASIA / OCEANÍA
  4. Why writing high-quality software is complicated?

  5. / SCHIBSTED MEDIA GROUP Failed Software Development There are a

    lot of reasons why a software development project can fail but one of the most common reason is:
  6. Software Engineers forgetting to write automated tests!!

  7. Testing?

  8. / SCHIBSTED MEDIA GROUP Testing Testing is the process of

    executing a program with the intent of finding errors… Glenford J Myers
  9. Excuses used to avoid write tests

  10. Scared to show that code works as expected.

  11. Requires time...

  12. Short deadlines

  13. People don't understand the value

  14. Why motivates you to write test?

  15. It’s professional

  16. It is our responsibility

  17. Give value to users & teammates

  18. The only way to make refactor

  19. It’s a tool for design

  20. It’s Money

  21. Validate our software

  22. Document Behavior our System

  23. “Bad code affect your customers, Martin Fowler”

  24. As Software engineers, we found problems to write automated tests.

  25. Our code is not ready to be tested.

  26. Developers start writing tests without knowing what to test and

    how to test it.
  27. Unreliable Tests ( falses / positives)

  28. Code coverage != Test quality

  29. “Mock” everywhere

  30. “Verify” everywhere

  31. Strong follower of Mike Cohn’s Test Pyramid

  32. / SCHIBSTED MEDIA GROUP Reliability Testing We are wasting time

    & life if we don't have reliable tests.
  33. Testable Code + Testing Strategies

  34. Testable Code

  35. Dependency Inversion Principle

  36. “Your code should always depend on abstractions and not concretions”

  37. / SCHIBSTED MEDIA GROUP Dependency Inversion Principle Hide implementation details

    creating layers with different responsibilities.
  38. SMMX Clean Architecture

  39. / SCHIBSTED MEDIA GROUP

  40. Testing Strategies

  41. What do we need to test?

  42. Business logic & Requirements

  43. / SCHIBSTED MEDIA GROUP Business Logic We need to test

    the application implements the business rules.
  44. Integration with API

  45. / SCHIBSTED MEDIA GROUP Server Side API integration The software

    should be prepared to alter software state according to Http Responses / Requests and JSON parsing expected.
  46. Integration with Persistence Library

  47. / SCHIBSTED MEDIA GROUP Persistence integration The queries we write

    to handle data from/to the local DB is working with our system correctly.
  48. UI Components

  49. / SCHIBSTED MEDIA GROUP UI Componets it's common to write

    custom views to be reused in a lot of places of the application so we need to ensure are working as expected.
  50. App User Interface

  51. / SCHIBSTED MEDIA GROUP User Interface The user is watching

    the expected UI according to app interactions and actions.
  52. How to test it?

  53. / SCHIBSTED MEDIA GROUP

  54. / SCHIBSTED MEDIA GROUP Testing Stack hiding Implementation details, you

    can use test doubles • JUnit • Mockito • Hamcrest • MockWebServer or WireMock • Persistence Room Testing • Expresso • Barista • Shot
  55. Show me code!

  56. Business logic & Requirements

  57. / SCHIBSTED MEDIA GROUP Business Logic hiding Implementation details, you

    can use test doubles
  58. / SCHIBSTED MEDIA GROUP Verify create verify tests is not

    enough
  59. / SCHIBSTED MEDIA GROUP Ensure Software States Check the final

    software state.
  60. Integration with API

  61. / SCHIBSTED MEDIA GROUP Server Side API integration hiding Implementation

    details, you can use test doubles
  62. / SCHIBSTED MEDIA GROUP Request contains headers hiding Implementation details,

    you can use test doubles
  63. / SCHIBSTED MEDIA GROUP Request in correct endpoint hiding Implementation

    details, you can use test doubles
  64. / SCHIBSTED MEDIA GROUP Mock JSON response AccountResponse.json hiding Implementation

    details, you can use test doubles
  65. / SCHIBSTED MEDIA GROUP Parsing JSON correctly hiding Implementation details,

    you can use test doubles
  66. / SCHIBSTED MEDIA GROUP Server Side Api Integration Kotlin Sample

    to practice Integration Test https://github.com/erikcaffrey/kotlin-integration-test
  67. Integration with Persistence Library

  68. / SCHIBSTED MEDIA GROUP Persistence integration hiding Implementation details, you

    can use test doubles
  69. / SCHIBSTED MEDIA GROUP Handling Queries hiding Implementation details, you

    can use test doubles
  70. UI Components

  71. / SCHIBSTED MEDIA GROUP UI components hiding Implementation details, you

    can use test doubles
  72. / SCHIBSTED MEDIA GROUP UI Behaviors & States hiding Implementation

    details, you can use test doubles
  73. App User Interface

  74. / SCHIBSTED MEDIA GROUP App UI hiding Implementation details, you

    can use test doubles
  75. / SCHIBSTED MEDIA GROUP Screenshot Testing hiding Implementation details, you

    can use test doubles Test framework that checks for visual differences across changes. com.package.segundamano.ads.AdsHolderScreenshots_expiredAd.png
  76. Do you think automated software testing matters?

  77. Thank You! QA Minds

  78. 01 02 http://www.wiley.com/WileyCDA/WileyTitle/productCd-1118031962.html The art of Software Testing https://www.amazon.es/Test-Driven-Development-Addison-Wesley-Signature/dp/0321146530 TDD

    - Kent Beck 03 Further Reading https://goo.gl/sduh0M Clean Code 04 Testad malditos - Jorge Barroso https://www.youtube.com/watch?v=vlorWIlPgY0
  79. https://goo.gl/ZWmJPR

  80. Questions? Find me Erik Jhordan Rey Android Tech Lead github.com/erikcaffrey

    erik.gonzalez@schibsted.com erikcaffrey.github.io @ErikJhordan_Rey +Erik Jhordan Rey