Building a testing culture

Building a testing culture

074c1726aee7c73df923c3d5064ab861?s=128

Pedro Tavares

May 10, 2018
Tweet

Transcript

  1. TESTING building CULTURE

  2. None
  3. THIS IS NOT ABOUT TDD!

  4. @ordepdev

  5. First of all Why testing?

  6. “It’s time for software developers to take up the mantle

    of responsibility for what they produce.
  7. Testing is the engineering rigour of software development.

  8. Responsibility — the state or fact of being accountable or

    to blame for something.
  9. Rigour — the quality of being extremely thorough and careful.

  10. Software Engineering

  11. An engineering discipline that is concerned with all aspects of

    software production.
  12. MUCH MORE THAN CODING!

  13. Types of Bad Software Projects

  14. 1. Without tests.

  15. Zero Automated Tests.

  16. ZERO!

  17. Lack of professionalism?

  18. Lack of skills?

  19. Lack of knowledge?

  20. Lack of time to test?

  21. It can be all of them.

  22. What about software quality?

  23. Relax, they test all features with manual testing.

  24. None
  25. 2. With Wrongly Designed Tests..

  26. Testing is HARD.

  27. None
  28. Testing pitfalls: coupling.

  29. Implementation Boundary Testing Boundary

  30. Implementation Boundary Testing Boundary ✅ ✅ ✅ ✅ ✅ ✅

    ✅ ✅ ❌ ❌
  31. Uncertainty and Doubt.

  32. Implementation Boundary Testing Boundary ✅ ✅ ✅ ✅ ✅ ❌

    ❌ ❌ ❌ ❌
  33. Testing pitfalls: performance.

  34. Taking too much time? — that’s a no run.

  35. Types of Testing

  36. 1. Testing after the implementation.

  37. 2. Testing during the implementation.

  38. 3. Testing that reproduce bugs.

  39. It’s our job to build a testing culture!

  40. But how?

  41. 5 rules.

  42. 1. Every change must have tests.

  43. 50 100 150 200 Development Unit Tests Functional Tests System

    Tests Production The cost of bugs
  44. Bugs in production are embarrassing and costly.

  45. 2. Write more than unit tests.

  46. Mutation testing!

  47. def add(x,y) x + y end def add(x,y) x -

    y end Source Code Mutation
  48. Property-based testing!

  49. http://blog.jessitron.com/2013/04/property-based-testing-what-is-it.html

  50. Contract testing!

  51. None
  52. Model-based testing!

  53. Try formal methods! https://www.infoq.com/presentations/aws-testing-tla

  54. 3. Bug fixing must have tests.

  55. Don’t repeat the same bug hunting — write a test!

  56. 4. Testing code must be reviewed.

  57. A well-designed test suite is much easier to read, understand

    and evolve.
  58. Testing code is production code!

  59. 5. Test suites must be consistent.

  60. L12. assertEquals(input, expectation); L35. assertEquals(expectation, input); L43. assertThat(input).isEqualTo( expectation); Assertions

  61. L12. assertEquals(input, expectation); L35. assertEquals(expectation, input); L43. assertThat(input).isEqualTo( expectation); Assertions

  62. L12. createEntity L35. create_withValidPayload_success L43. create_withValidPayload_shouldPersistEntity Test Methods

  63. L12. createEntity L35. create_withValidPayload_success L43. create_withValidPayload_shouldPersistEntity Test Methods

  64. We must share the same values, practices, and tools.

  65. Enforce them through code reviews, static analysis, and style checking

    tools.
  66. Wrapping up.

  67. “People who are successful at automating tasks tend to work

    this way in every aspect of their jobs. It is just how they work; it is part of their culture.”
  68. Manual work is a bug. acmqueue | january-february 2018

  69. ALWAYS BE AUTOMATING!

  70. GO AND FIX YOUR BROKEN CULTURE!

  71. TESTING building CULTURE