unit 4: Test Driven Development vs. software testing – kishore k

Test Driven Development uses the “test first” approach in which test cases and the unit tests are written before code is written. The unit tests are written by the developers and once the unit tests pass the developers start developing the application and code the application. The software development becomes a series of very short iterations in which test cases drive the creation of software and ultimately the design of the program.

The unit tests forms the pillar for the development of the application in a TDD Development Environment  Kent Beck, who is credited with having developed the technique, stated that TDD encourages simple designs and inspires confidence.

Test-driven development cycle


What makes TDD unique is its focus on design specification rather than validation. The TDD approach leads to higher quality software architecture by improving quality, simplicity, and testability while increasing code confidence and team productivity.

The basic steps of TDD are :

Step #1- Create/add a new test.:

To write a test, the developer must clearly understand the feature’s specification and requirements. The developer can accomplish this through use cases that cover the requirements and exception conditions.

Step #2- Run the test to ensure that it fails.

This step rules out the possibility that the new test will always pass, and therefore be worthless. The new test should also fail for the expected reason. This increases confidence  that it is testing the right thing, and will pass only in intended cases.

Step #3- Write just enough code so that the test will pass.

The next step is to write some code that will cause the test to pass. The new code written at this stage will not be perfect and may, for example, pass the test in an inelegant way.

Step #4- Refactor the new code to remove duplication and unnecessary complication.

It is important that the code written is only designed to pass the test; no further and therefore untested functionality should be predicted and ‘allowed for’ at any stage.If all test cases now pass, the programmer can be confident that the code meets all the tested requirements.

Step #5- Ensure that refactoring did not break the code under test.

The concept of removing duplication is an important aspect of any software design.
By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality

Step #6- Repeat this process until all tests have been written and passed.

After the successive steps the repeat process is carried out so that the by starting with another new test, the cycle is then repeated to push forward the functionality


Software testing is a process used to identify the correctness, completeness, and quality of developed computer software. It includes a set of activities conducted with the intent of finding errors in software so that it could be corrected before the product is released to the end users.

In simple words, software testing is an activity to check whether the actual results match the expected results and to ensure that the software system is defect free.

Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation. Test techniques include the process of executing a program or application with the intent of finding software errors or other defects.
Software testing can be intended to,
• meets the requirements that guided its design and development,
• works as expected,
• can be implemented with the same characteristics,
• and satisfies the needs of stakeholders.

Conclusion :

With software testing process,

we cannot test a program completely
We can only test against system requirements
May not detect errors in the requirements.
Incomplete or ambiguous requirements may lead to inadequate or incorrect testing.
Exhaustive (total) testing is impossible in present scenario.
Time and budget constraints normally require very careful planning of the testing effort.
Compromise between thoroughness and budget.
Test results are used to make business decisions for release dates.
* Even if we do find the last bug, we’ll never know it
* we will run out of time before we run out of test cases
* we cannot test every path
* we cannot test every valid input
* we cannot test every invalid input

On the other hand with TDD approach we can achieve

Improved Quality
The TDD approach forces each component to steadily build capability at a consistently higher level of quality by testing first, developing in small increments, and requiring tests to pass. Once individual component development switches to integration, this high level of component quality leads to rapid integration and more effective testing.

Promotes Simplicity
During the implementation of a feature, the test-driven developer writes the simplest code to make the tests pass. TDD helps developers avoid over-engineering solutions due to its short development micro-cycle. It also helps break the problem into modular units and produce a solution that can be tested as well as implemented.

Cuts Time-to-Market
The TDD cycle is shorter than the traditional development cycle. By focusing on building only what is needed to get the tests to pass and using immediate feedback to reduce regression errors, the development cycle can quickly be reduced to its essential core.

Enhances Flexibility

TDD boosts a software development organization’s ability to rapidly respond to changing requirements or unanticipated product updates by facilitating shorter development and integration cycles and supporting the rapid refinement of new requirements. A solid TDD culture with a rich test base is the best preparation to rapidly seize opportunities and beat competitors to market.



Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: