Tackling developers in the heart of testing world

Tackling developers in the heart of testing world

Write tests should be a practice that we need to do every time when we are developing software, the talk was an introduction to start in the testing world.

9f523401a845a29c93ff73cde4c3db2b?s=128

Erik Jhordan Rey

April 01, 2017
Tweet

Transcript

  1. Tackling developers in the heart of testing world Erik Jhordan

    González Reyes Mobile Engineer at Segundamano erik.gonzalez@schibsted.com.mx @ErikJhordan_Rey github.com/erikcaffrey
  2. / SCHIBSTED MEDIA GROUP Erik Jhordan Rey “Mobile Engineer believer

    on software architecture, design patterns, clean code, solid and testing.” Mobile Engineer 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. “Segundamano is the quickest and easiest way for people like

    you to sell and buy used things”
  5. Mobile Team ➔ Carmen Salvador ➔ Diego Ramirez ➔ Ivan

    Alvarez Frias ➔ Juan Pablo Villa ➔ Quentin Désert ➔ Arturo Gutierrez ➔ Jose Luis Cadena ➔ Ranferi Dominguez
  6. ➔ UI ➔ Performance ➔ Arquitectura ➔ Tools Android Smells

  7. Technical Debt

  8. Technical Debt ➔ Does team have the same level? ➔

    Is it easy to onboard new people? ➔ Is the code consistent? ➔ Is hard to maintain? ➔ Can we add a new functionality fast? ➔ Can we get kpi’s on easy way? ➔ Can measure and monitoring the app? ➔ Is our code base preparate to scale? ➔ Is our code preparate to write test?
  9. Architecture

  10. / SCHIBSTED MEDIA GROUP ➔ Passes all tests ➔ Reveal

    al idea ➔ No Duplication ➔ Minimized classes and methods Simple design
  11. / SCHIBSTED MEDIA GROUP Decoupled Architecture

  12. / SCHIBSTED MEDIA GROUP View Presenter ViewController Use Case Use

    Case Use Case Domain Model Data Source Implementation Repository Repository Data Source Data Source Data Source Implementation Presentation Layer Domain Layer Data Layer Navigator
  13. Testing

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

    executing a program with the intent of finding errors… Glenford J Myers
  15. “Depend upon abstractions. Do not depend upon concrete classes”

  16. What motivates you to write test?

  17. It is your responsibility

  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. Test Driven Development

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

  25. Unit Testing

  26. / SCHIBSTED MEDIA GROUP

  27. “Unit test are not silver bullets”

  28. / SCHIBSTED MEDIA GROUP FIRST Fast Independent Repeatable Self-validating Timely

  29. Test Doubles

  30. / SCHIBSTED MEDIA GROUP Test Doubles Dummy Stub Spy Mock

    Fake
  31. / SCHIBSTED MEDIA GROUP Dummy objects are passed around but

    never actually used. Usually they are just used to fill parameter lists.
  32. / SCHIBSTED MEDIA GROUP Stubs Provide canned answers to calls

    made during the test, usually not responding at all to anything outside what's programmed in for the test.
  33. / SCHIBSTED MEDIA GROUP Spies Are stubs that also record

    some information based on how they were called. One form of this might be an email service that records how many messages it was sent.
  34. / SCHIBSTED MEDIA GROUP Mock Are pre-programmed with expectations which

    form a specification of the calls they are expected to receive. They can throw an exception if they receive a call they don't expect and are checked during verification to ensure they got all the calls they were expecting.
  35. / SCHIBSTED MEDIA GROUP Fake Objects actually have working implementations,

    but usually take some shortcut which makes them not suitable for production (an InMemoryTestDatabase is a good example).
  36. / SCHIBSTED MEDIA GROUP Arrange Act Assert

  37. Testing on Android

  38. / SCHIBSTED MEDIA GROUP Building Testing Pipeline

  39. “Test my http client requests and responses”

  40. “Test my code implements the business”

  41. “Test user is watching UI expected”

  42. Testing tools

  43. / SCHIBSTED MEDIA GROUP Testing tools Hamcrest JUnit Mockito Espresso

  44. / SCHIBSTED MEDIA GROUP O’Reilly Free Programming The main goal

    is to practice good practices, architecture and testing. https://github.com/erikcaffrey/oreilly-books-android
  45. • Depend on abstractions do not depend on concrete class

    • Use design patterns on smart way • Maintain a clean code style • Write Clean and Solid Code • Favor composition over inheritance • If your code is coupled the Refactor is your friend • Write test is your responsibility • Understand the tools before used it • Automatize Advices
  46. Questions? Find me Erik Jhordan González Reyes Mobile Engineer github.com/erikcaffrey

    erik.gonzalez@schibsted.com.mx erikcaffrey.github.io @ErikJhordan_Rey +Erik Jhordan Rey
  47. 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
  48. Thank You! Androidnights