Software Engineering Ecosystem

Share this post

Why a maintainable and readable test suite is important to stay agile

ecosystem4engineering.substack.com

Why a maintainable and readable test suite is important to stay agile

Adaptability and Confidence to Change

Klaus Häuptle
Apr 9, 2023
Share this post

Why a maintainable and readable test suite is important to stay agile

ecosystem4engineering.substack.com
1

Why do we need an effective test suite

As development teams we need an effective test automation suite, which is fast, maintainable and robust: Test Automation should be able to quickly catch bugs, and this makes it possible to change software with confidence, which enables teams to iterate faster and adapt more quickly to changing market conditions, technologies or customer requirements. Writing automated tests early also improves the design of your system - it forces teams to confront architecture and design issues from the beginning, which leads to more modular and adaptable software.

Adaptability: Principles for a maintainable and readable test suite

In order to keep the software adaptable and the team productive it is also very important to keep the tests maintainable. Having a well-structured code base and a good test strategy helps here. For example an interface with too many parameters and a class with too many dependencies can also make the tests hard to maintain. Besides, there are some simple rules for writing tests itself, which have a huge impact on readability and maintainability. Here are two simple rules to keep unit tests maintainable:

  • Be descriptive: Naming things is hard, but it’s important to give your tests descriptive names that clearly indicate what they’re testing.

  • Stay focused: Unit tests should be subject to the single-responsibility principle. Each test should focus on one thing and one thing only.

There are a lot more rules every developer should know about and they only require a little discipline to apply. It is therefore worth to learn the principles and put special attention on readability of tests during your code review to get a common understanding in the team.

The Clean Code books and the Open Source repository contain a lot of guidance on how to keep tests readable and maintainable. You can find more details in the blog Clean Code: Writing maintainable, readable and testable code


Subscription: If you want to get updates, you can subscribe to the free newsletter:

Mark as not spam: : When you subscribe to the newsletter please do not forget to check your spam / junk folder. Make sure to "mark as not spam" in your email client and move it to your Inbox. Add the publication's Substack email address to your contact list. All posts will be sent from this address: ecosystem4engineering@substack.com.

✉️ Subscribe to the newsletter — if you aren’t already.

❤️ Share it — The engineering ecosystem newsletter lives thanks to word of mouth. Share the article with someone to whom it might be useful! By forwarding the email or sharing it on social media.

Share Engineering Ecosystem

Thanks for reading Software Engineering Ecosystem! Subscribe for free to receive new posts and support my work.

Share this post

Why a maintainable and readable test suite is important to stay agile

ecosystem4engineering.substack.com
1
Share
1 Comment
Share this discussion

Why a maintainable and readable test suite is important to stay agile

ecosystem4engineering.substack.com
Stephen R. Palmer
Apr 11, 2023

Key to a maintainable and readable test suite is a clear test data strategy that ensure tests are independent of one another as much as possible. Being clear what data can be expected to exist in the system under test: none, essential data like countries, currencies and languages, common test data like a known set of example products, etc. Ensuring tests do not modify any of that base test data. Ensuring closely related sets of tests create and teardown the specific test data they need to use and modify. Ensuring unique identifiers for specific test data items cannot clash with existing data items, and so on. More and more when testing at API level, it is less about the end point being called and more about the payload provided and returned.

Expand full comment
Reply
Share
Top
New
Community

No posts

Ready for more?

© 2024 Klaus Häuptle
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing

Our use of cookies

We use necessary cookies to make our site work. We also set performance and functionality cookies that help us make improvements by measuring traffic on our site. For more detailed information about the cookies we use, please see our privacy policy. ✖