Everything is achievable through technology

TDD (Test Driven Development)

Main reason to follow TDD

Improve Software Quality   { internal and external quality }  also  it’s  The art of fearless Programming

•External quality characteristics are those parts of a product that face its users, where internal quality characteristics are those that do not.
  Features: •Functionality•Reliability•Usability•Efficiency•Maintainability•Portability
  User’s view of the quality:  •Effectiveness•Productivity•Safety•Customer Satisfaction

Test Driven Development (Test First Development) is the process where we write a test First  Then we write code to make the test pass.Then we find the best possible design for what we have – refactoring (Relying on the existing tests to keep us from breaking things while we are at it) 


first create a test case, fail it, do the implementation, ensure the test case success, re-factor the code and then continue with the cycle again

TDD also states that every code which is deployed to production should be covered by the unit test case.

The best practices in writing the unit test cases are to follow the F.I.R.S.T principles. Here is a brief explanation for each of them.

Fast – Write the unit test cases by keeping their performance in mind. This is required because you will have to run thousands of them during every release.

Isolated – Each test case to be isolated to a particular behavior i.e. in-case of a failure the developer should know what went wrong without having to go through the execution flow. A test case should be broken down into multiple smaller ones for this purpose.

Repeatable – The test case should be stable so that it provides the consistent results over multiple runs.

Self validating – The test should result in a pass or a failure. There should not be any ambiguity scenarios with assertions.

Timely – This is more important for TDD as the test cases should be created before the actual implementation is.

 What are the goals of TDD?

TDD is a technique for improving the software’s internal quality ;

Well-written code{•Good design•A balanced division of responsibilities•Without duplication (clones)•Smooth evolution•Maintainability}

ATDD goals; Acceptance TDD helps us keep our product’s external quality on track by giving it the correct features and functionality.the system should meet what the customer actually need

it’s one way to think through your requirements or design before your write your functional code. Another view is that TDD is a programming technique . the goal of TDD is to write clean code that works.Tests are documentation of what our code does,we can quickly regression test our code.Test a little and build a little gives confidence.reduce the effort of final delivery.

What are the problem of TDD?

  1. It became a daunting task  when requirements changes and unit tests  is not done as best practices (maintainable, readable, and trustworthy) then any little  change in our code broke them, even though the code was working fine.This is the impotent reason programmers ended up throwing out most of the tests.
  2. Time(i don’t have time to do TDD): some programmers think its just a waste of time because they don’t want to fix bugs ,create test cases,figure out what the code is supposed to do, any re-factor break the code,etc.

solution: Think long term not short term.

 There are two levels of TDD

  • Acceptance TDD (ATDD)

With ATDD you write a single acceptance test, or behavioral specification depending on your preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for your solution on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).

•Acceptance tests are indicators of the completion of a requirement or feature.

• When all acceptance tests for a requirement or feature are passing, you know you’re done.
  • Developer TDD

With developer TDD you write a single developer test, sometimes inaccurately referred to as a Unit Test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for your solution on a JIT basis.  Developer TDD is often simply called TDD.

TDD and acceptance TDD often go hand in hand. On the system level, we run our development process with acceptance TDD; and inside the implementation step of each feature; we employ TDD

Tools for test-driven development

•Unit-testing with xUnit
–Provides supporting code for writing unit tests, running them, and reporting the test results.
•Test frameworks for acceptance TDD
–Tools for enhancing collaboration in software development. (Fit and Fitnesse)
–They enable customers, testers, and programmers to learn what their software should do, and to automatically compare that to what it actually does do.
–They compare customers’ expectations to actual results.
•FitNesse is a lightweight, open-source framework that makes it easy for software teams to:
–Collaboratively define Acceptance tests — web pages containing simple tables of inputs and expected outputs.
–Run those tests and see the results

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s