Better Test Scripts: Untangling Your Spaghetti Test Code

Test automation engineers often take not enough care of the test scripts. In many of software testing teams we work in, test code is treated much less carefully than production code. It is expected that the test scripts just work. Mindless copy and paste of setup code from one test case to another is seldom seen as problematic, duplications are widely accepted, and things are named randomly.

Managing spaghetti test code always leads to problems:

  • gaps in assertions become pretty non-obvious
  • consolidating long-running test suites becomes a cumbersome task
  • magic numbers need to be changed all across the suite, when they become outdated

Problems like these (“tangles”) affect the overall maintainability of our overall code base.

Over the years the presenter has identified several good practices (“untangles”) to prevent these problems with test automation and keep test code maintainable. Some are borrowed from general good code quality standards, some are specific for test code. This presentation briefly discusses the properties of good test code. He presents a bunch of good practices and shows them applied to an example (in Java). In the end, you should be able to identify tangled code and apply the techniques to untangle your test scripts.

Video producer: https://oredev.org/

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.