Blog

Test Driven Development

Test-Driven-Development

Introduction

As the name suggests for “test driven design” / “test-driven development (TDD)”, is a software development process in which the developers review the requirements like a test engineer, write automated test case for the user story / function, and finally write down the code to pass that test. Developers & testers need to be very active in realizing the fact that how application under development will be used in the real world.

Test-Driven Development Cycle

  • Add a Test: New feature should begin with writing an automated test case first.
  • Write some Code: Write some code that causes the test to pass.
  • Run Tests: The developer will become confident if all the test case passes the code according to the requirements.
  • Refactor Code: The growing code base must be cleaned up regularly during TDD.
  • Repeat: Starting with another new test, the cycle is then repeated to push onward the functionality.

Role of QA in TDD:

  • One must understand that TDD is not a QA method; it is a development approach which restricts itself only to unit testing.  Separate team of developers and testers has benefits of increased specialization or when any product is needed to be tested on multiple hardware/software platforms independently.
  • It is of no use if the programmer misunderstands the end goal. Here think of testers as technical analyst & investigators of the whole process help the programmers understand their ultimate goal.
  • QA is involved in Agile throughout and the vital part of any team crafting the test cases when the requirements are still changing.
  • Tester goals; Functionality and quality: The testing team helps in checking the functionality while also check the quality of the product. A good test engineer will always ask “what happens if…?”
  • Tester tends to be business-focused or technically-focused when it comes to practicing their testing techniques. Business-focused testers will help customers express functional requirements through examples. Whereas, technically-focused testers will help customers express non-functional requirements, such as performance and scalability needs.

Benefits:

  • TDD makes certain that all the modules of the application are tested individually & also well integrated with each other. This in turn ensures that application is bug free, user friendly and meeting all of the requirements too.
  • As, tests are run from the very start of the design phase, money & time is highly minimized and also resulting in the decline of defects/issues quantity.
  • Incremental approach is adopted while problems and issues are solved and the test written for the particular user story or case is done many times.

Drawback:

  • Sometimes the test can be incorrectly perceived and applied from the actual requirement resulting in the wrong results in the end.

It can be concluded that the major dependency is on test cases as both developers and QA use test cases to develop their code and execute test cases respectively. It is important to have well written test cases that have good coverage of requirements. QAs know the overall system much better than a developer as they test the system End-to-End so QA team in every phase of TDD should be involved from the very beginning. QA should work together with the developer to make sure that unit testing is built into the core of the application.