QA Revolution

What is Test Driven Development (TDD)?

what is test driven developmentThere has been a lot of information shared over the past few years about Test Driven Development.  Initially it might seem complicated and counter to logical thinking but it actually makes a lot of sense.  Test Driven Development is defined as: a software development process that relies on the repetition of a very short development cycle.  Requirements are turned into very specific test cases and the software is modified in order to get those tests to pass.  In the normal process of software development, code is written first and then tested to make sure that it works.

 

 

 

 

What is the origin of Test Driven Development?

The origin of TDD traces back to the late 1990’s when extreme programming started.  It because more mainstream when Agile came around.  By 2006 it had matured and resulted in additional innovations to the process with ATDD or BDD.

What are the steps for Test Driven Development?

Here are the basis steps for TDD:

  1. Write a new test
  2. Check and make sure the test fails
  3. Write code to pass the test
  4. Verify the test passes
  5. Refactor code to make it more efficient
  6. Repeat steps again

What is the purpose of Test Driven Development?

TDD is a process of modifying code in order to pass a test which was designed prior to code being written.  There is more emphasis on writing production code than designing test cases.  This includes refactoring and helps to have cleaner and simpler code.  It helps to find defects much sooner and eliminates the need of rework.

What is Agile Test Driven Development?

All the teams today that use Test Driven Development follow Agile or some form of it like Scrum.

Who is responsible for Test Driven Development?

Typically the person who is writing the code will be the person to write the test cases.  I have seen some situations where there is a slight variation and a test engineer writes them but that is not a common practice.

What are the benefits of Test Driven Development?

  1.  The primary benefit of TDD is that it helps to eliminate writing duplication of code
  2. Allows developers to capture defects much sooner in the lifecycle
  3. Software is better designed and results in more maintainable code
  4. Helps with teamwork.  More people can work on code together.
  5. Less time is spending on debugging code
  6. Helps with code refactoring
  7. Eliminates a significant number of defects
  8. Often results in projects getting completed faster than original timelines

What are the pitfalls of Test Driven Development?

Here are some common pitfalls of TDD:

  1. Forgetting to run the tests
  2. Writing too many tests
  3. Writing tests that are too large
  4. Writing tests that are too simple
  5. Writing tests that are too complicated

Test Driven Development Skill Levels

There are different skill levels for TDD which include:

  • Beginner
    • Someone who can write a unit test prior to code creation
    • Someone who can get a failing test to pass by writing code
  • Intermediate
    • Someone who can write a test case for a defect that has been found
    • Someone who can take a previous test driven development test and further break it down to simpler tests
    • Someone who can factor reusable elements
  • Expert
    • someone who can create a test driven development roadmap
    • someone who can provide additional guidance and direction to beginner or intermediate levels

I hope this information has been helpful.  You might want to also learn more about Behavior Driven Development.