Automated Testing, Test Driven Development and Paired Programming
What is Test Driven Development?
Test driven development (TDD) is a software development process that’s often combined with an agile approach to development, which involves converting software requirements into automated test cases or unit tests before pieces of functioning code. This method replaces the common process of software being developed first and being tested as a separate subsequent step.
The ‘Red - Green Refactor Cycle’
The steps involved in test driven development are sometimes referred to as the red - green refactor cycle. Here are the common steps in the red-green refactor cycle.
The first step is understanding what needs to be achieved. This is essential.
Next a test case or unit test is created with the intent of failure. This is the ‘red’ part of the process.
Now it's time to implement code that fulfills the requirement. At this point the test should pass and if it doesn’t, then these steps are iterated. This is the ‘green’ part of the process.
This when the refactor part comes in, where the code is optimized.
The whole process is then repeated until all test cases pass.
Benefits of Test Driven Development
TDD is important because it keeps code clean and bug-free, as well as optimized. Coders have to think about the desired output of the code from the onset, which helps ensure that the code will achieve what it's meant to. The problems encountered within the code are also broken down into more manageable pieces, making the process less overwhelming.
Paired Programming
Paired programming is another method of software development involved in Agile methodologies, and is based around the idea of two programmers working together to develop a piece of code. One programmer will be the ‘driver’, whose role consists of writing the code and the other programmer is the ‘observer’ who writes the test and checks the code for errors and opportunities for optimization. This reduces the amount of mistakes as two programmers are working on the same code.
SRG and Test Driven Development
SRG incorporates test-driven development and peer code review as its standard approach to development. Automated testing is built into continuous integration pipelines to ensure high-quality code and consistent bug-free deployments. We leverage paired programming as project budgets allow and for onboarding new developers onto a project.
Written by:
Maxine Wesley