Agile software development is gaining traction in more and more companies these days. But all coding agility loses its purpose if your software testing practices are not up to speed. The mindshift that still needs to happen here is that in an agile environment, you have to think about testing already while or even before you code. In this article, I’ll show you three easy steps that you can do today as a developer to transform to agile unit testing.
1Write actual unit tests
There are many best practices that guide you through the process of writing unit test code. There are FIRST principles (F.I.R.S.T principles of testing) or equivalence class partitioning (2 methods that help you save 60 % of your effort in Unit Testing) for creating the right tests, or the arrange-act-assert pattern (The AAA Test Pattern explained with C# and NUnit) for structuring your code.
There is a reason why these methods are considered best practices, an this reason is maintainability.
In an agile environment, this maintainability is your only chance of survival if you want to have tested software code.
Usually, one code change kills a whole bunch of unit tests. In an agile environment, there will be a lot of changes. So before you can even start talking about agile unit testing, you have to make sure that your unit test suite is ready for it. Do this by sticking to all the best practices that are already out there to help you maintain your unit tests. Sound challenging? Here’s a checklist that you can simply apply to you test suite to ensure it’s state-of-the-practice: The Ultimate Checklist for Better Unit Testing
2Reduce the time-to-test for new code
If you are working on a new feature, you want to ship it fast. But before shipment, it needs to be tested. So make sure that tests are ready once the code is, to not loose any valuable time. And then make sure to minimize the time needed by testers to write good test cases, and for you to find potential bugs. This can be done by writing testable and maintainable code (see step 1).
3Automate as much as possible
Only as a third step, you can focus on the actual automation that needs to take place to ensure that unit testing makes your software development process even more agile. Create a CI/CD pipeline that runs your unit tests on every checkin or deployment. Require that all unit tests pass for newly added code, to avoid introducing any error to your code base before shipment. Create a test gate that ensures that code can only be checked in if its quality is ensured, by requiring a certain code coverage to be fulfilled.
hese easy and automatable tasks gives you the confidence to ship your code at any given time -> this is where agility starts!
So, these are my three easily applyable steps to transform to agile unit testing. What is your experience in applying agile unit testing? What are your personal troubles with software testing in an agile environment? Let me know in the comments section below!
When you visit any web site, it may store or retrieve information on your browser, mostly in the form of cookies. Control your personal Cookie Services here.