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

Are Your Tests Slowing You Down?

Trisha Gee
September 19, 2024

Are Your Tests Slowing You Down?

Testing is a Good Thing, right? Especially automated testing. But "Good things come to those who wait" is not something that's going to appeal to the busy developer. You want results, and you want them now. You're in The Zone working on a problem, and the last thing you want is to break your flow wrestling with your testing framework or waiting for the tests to finish running.

More code means more tests. More coverage means more tests. More tests mean more time. Time that you want to spend being productive, creative, innovative. How can you balance the need for quality with the need for speed?

In this talk, Trisha will identify issues that slow down developers when writing, running and debugging tests, and look at tools that can help developers with each of these problems. There will be live coding, analysis of social media poll results, an overview of solutions in this space, "best practice" recommendations, and machine learning will be mentioned at some point.

Trisha Gee

September 19, 2024
Tweet

More Decks by Trisha Gee

Other Decks in Technology

Transcript

  1. “The productivity myth suggests that anything we spend time on

    is up for automation…. The importance and value of thinking about our work and why we do it is waved away as a distraction. The goal of writing… is filling a page rather than the process of thought that a completed page represents.” https://www.techpolicy.press/challenging-the-myths-of-generative-ai/ Eryk Salvaggio
  2. “We recommend that the developers, who are good at writing

    efficient, maintainable code, work together with the testers, who are good at specifying test cases, to automate tests.” Agile Testing Condensed: A Brief Introduction Lisa Crispin, Janet Gregory
  3. Your test needs to tell you what is expected and

    why, so you understand what to do when it fails.
  4. “99.9% of the time the best way to troubleshoot a

    test is to re-write it so it’s smaller and faster.” Israel Boza Rodriguez (@IsraKaos)
  5. If you add a new test and it’s flaky Or

    are working on a test and it becomes flaky Fix it now!!
  6. 1. When they impact you directly 2. Attach them to

    related functionality 3. Flaky Test Days 4. Add flaky tests to the backlog 5. 20% time, tech debt time, cleanup time… Make Time To Fix Flaky Tests
  7. 1. Environment, Network, and Resources 2. Integration Points 3. Concurrency,

    Asynchronous Programming, and Waiting 4. Setup/Teardown and Test Data 5. System Behaviour Causes of flakiness Known good practices and tools Not always in my control Try to minimise these Can be REALLY HARD
  8. Test Distribution Results ‑ ~50% ‑ ~50% ‑ ~50% Doubling

    the number of executors cuts build time in half
  9. “The test selection procedure selects fewer than a third of

    the tests that would be selected on the basis of build dependencies” Predictive Test Selection - Meta Research https://research.facebook.com/publications/predictive-test-selection/ Mateusz Machalica, Alex Samylkin, Meredith Porth, Satish Chandra
  10. “Once things like databases become a hindrance, optimise the testing

    loop, mock things out to run things fast. You can run locally and you don't have all the same infra dependencies as someone else.” On DevEx, PaaS, and Testing in Production https://bit.ly/3ZA0uQM Kelsey Hightower
  11. ⬢ Separation of concerns ⬢ Encapsulation ⬢ High cohesion and

    loose coupling ⬢ SOLID ⬢ DRY ⬢ Descriptive naming ⬢ Modularisation ⬢ Designing for performance
  12. “Yes, I regularly delete tests that no longer add unique

    value.” Angie Jones (@techgirl1908)
  13. Invest time in writing better tests. They will be easier

    to debug, less flaky, and better document your system’s expected behaviour
  14. “Testing is not only for checking the system does what

    it’s supposed to, it’s for documenting the expected behaviour.” Israel Boza Rodriguez (@IsraKaos)