Automated Unit Testing is a process where developers programmatically test their code using test frameworks such as the XUnit framework. Code is not considered complete unless it is accompanied by a test case. Agile teams have embraced unit testing. Waterfall teams can also do so without disruption to their process.
Introduction
Agile software development teams have reaped significant benefits by adopting “Automated Unit Testing” as a part of the development process. For teams that are considering becoming more agile, adopting “Automated Unit Testing” would be a good start. It can be easily embraced without significant impact on the process. “Automated Unit Testing” is a process where programmers write test cases for their code using testing frameworks such as the XUnit framework. Ideally, the test cases are written first followed by the implementation of the production code. When all the tests pass, the implementation is complete.
Challenges in “Automated Unit Testing”
More than the impact on the process, the challenge is in getting teams to adapt to this process. In waterfall process, development teams typically provide the implementation and throw it over the wall for QA to test. Asking programmers to prove that the code works before handing it over to QA is a significant paradigm shift. Writing tests is also hard – especially if the code has not been written in a testable way. Developers may have to spend as much time writing the test cases as the production code itself. To most developers, this seems like a waste. However, this pays off in terms of producing code with fewer defects.
Better late than never
It’s never too late to write tests. Tests are most effective if they are written at the time the production code is being written. However, you could introduce them even as defects are being fixed for existing code. When a defect is fixed, insist that tests be written for it. This allows for an incremental creation of test suites. Test suites allow for your code to be flexible. Their presence lets you re-factor with confidence.
Conclusion
Automated Unit Tests are a pillar of agile teams. For teams that want to adopt agile practices, this is a great way of adopting one of its pillars without disrupting existing processes. It’s never too late to adopt Automated Unit Testing. Embracing it in Waterfall also sets the stage for adopting the other important aspects of the Agile methodologies.