Improving Application Quality Using Test-Driven Development

Improving Application Quality Using Test-Driven Development
21 Feb 2017

What is the one activity or phase that improves the quality of your application? The answer is an easy on: Testing, andplenty of it. But when do we traditionally perform testing? If you are following a “waterfall” style approach to softwaredevelopment, it’s very likely that you have a testing phase somewhere towardsthe expected end of the project. This is peculiar, because we all know that atthis stage in a software development project, the cost of any code orrequirement changes is known to be much higher.

What is TDD?
TDD is radical process that promotes the notion of writing test cases that then dictate or drive the further development of a class or piece of code. This is often referred to as “writing tests first”. Indeed, I will refer to the phrase “writing tests first” as one of TDD’s primary principles.
Whilst I refer to TDD as a “process”, followers of Agile communities including XPers (eXtreme Programming), will know TDD as an integral “core” practice. Appreciating that many of the XP-oriented books push TDD as a primary part of their content, we are lucky enough to be able to adopt TDD as a process that can be “bolted” on to our existing software development process, regardless of whether it is Agile, waterfall, or a mix of the two. There may well be entrenched differences in the semantics of the words practice and process. I believe that TDD in an Agile/XP environment, perhaps were Scrum is practiced, TDD can also be practiced. However, outside of a strictly Agile environment, TDD is a sub-process that becomes part of the development process.

Removing The Boredom Of Testing
Notice that I used the phrase: “writing tests first”. If we are to remove the boredom of the testing process, we need to codify the tests that we would perform. By writing test cases, typically in the programming language that the application or class under test is written using, we are essentially automating the test process.

Automating the process is the key. If we can make the tests easy to perform once, twice, three and four times, ideally at the click of a button, developers will be happy to run the tests frequently. Of course, each time we run the tests, we are performing the same tests, over and over again, the tests are said to be repeatable.

TDD Frameworks and Tools
TDD has origins in the Java and Smalltalk camps. Originally there was a tool by the name of SUnit (for Smalltalk). Thatwas followed closely by a tool called JUnit (for Java). Since then, the term ‘xUnitframework’ has been used to represent language agnostic versions of the sametool. The xUnit framework has been ported to many different platforms and languages.


Leave a Reply

Your email address will not be published. Required fields are marked *