Short note on Test Driven Development [TDD]
1 Answer

Test Driven Development (TDD):-

Test-driven development (TDD), also called test-driven design, is a method of implementing software programming that interlaces unit testing, programming and refactoring on source code.

Test-driven development was introduced as part of a larger software design paradigm known as Extreme Programming (XP), which is part of the Agile software development methodology.

Test-driven development starts with developing test for each one of the features. The test might fail as the tests are developed even before the development. Development team then develops and refactors the code to pass the test. Test-driven development is related to the test-first programming evolved as part of extreme programming concepts.

Steps of the test-driven development approach:-

Before any new code is written, the programmer must first create a failing unit test. Then, the programmer -- or pair, or mob -- creates just enough code to satisfy that requirement. Once the test is passing, the programmer may re-factor the design, making improvements without changing the behavior.

enter image description here

Test-Driven Development Process:

• Add a Test

• Run all tests and see if the new one fails

• Write some code

• Run tests and Refactor code

• Repeat


enter image description here

Context of Testing:

• Valid inputs

• Invalid inputs

• Errors, exceptions, and events

• Boundary conditions

• Everything that might break

Benefits of TDD:

• Much less debug time

• Code proven to meet requirements

• Tests become Safety Net

• Near zero defects

• Shorter development cycles

Please log in to add an answer.