Test driven development or TDD is considered to one of the most
effective as well as efficient software development methodology or process that
is often cited under the category of the agile software development processes.
The term “test driven development” is self justifying as one make out from the
term itself that it is driven by the tests. Actually, the test driven
development process is wholly based up on the repetition process of the several
development cycles that are shorter than the usual development cycles.
This
whole article is dedicated to the discussion regarding the test driven
development cycle.
What are the steps in TDD process?
Test driven development process involves the below mentioned
steps:
1. First step
involves the creation of an automatic test case that is failing and defines a
new function or some desired improvement in the code.
2. Second step
involves the production of code which can pass the test.
3. Third and the
final step involves the re-factoring of the new code in order to meet the prescribed
standards.
This development strategy or process was introduced in the year of 2003
by Kent beck. The first programming concepts of the extreme programming or XP
are considered to be related to the concepts of the test driven development to
some extent.
But, nowadays the test driven development has been observed to be
an individual development methodology with its own rules and independent
procedures. The test driven development process has proved to be successful in
improving and debugging legacy code that has been developed using the older
development techniques.
We all know that every development process has its own
requirements so here in this the requirements are the automated unit tests that
provide a definition of the code requirements and create the associated code
themselves.
Test Driven Development Cycle
Now let us describe the test driven development cycle in detail and
sequence:
1. Adding of a
test:
- In test driven development, for every feature to be added, first a test
is written that is inevitably expected to fail since it is written before the
actual implementation of the features.
- If the test does not fail, then there
are two probabilities: the test is either wrongly formulated or the feature for
which the test has been created already exists.
- The test should be written with
utmost understanding of the specifications and requirements which can be
achieved from the use cases and user stories.
- An already existing test can also
be modified.
- Writing unit tests before the implementation of the feature helps
the software developer or program focus up on the requirements before the
actual code is written.
- This feature of the test driven development
differentiates it from the others and leaves a subtle and important effect.
2. Execution of
all the tests and check if they fail:
- This step involves the validation of the
test harnesses for their proper working.
- This is done to ensure that no test
passes mistakenly without requirement of new code.
- The test itself is also
tested but in the negative so that all the possibilities of passing of the new
test are ruled out making it worthless.
3. Production of
code:
- This step involves the production of code by virtue of which the test
will pass.
- The code even if its no perfect is accepted since later it can be
improved.
4. Execution of
the automated tests:
After all the tests have passed, the developer can be
confident that the code is perfect.
5. Refactorization
of the code:
This involves clean up drive of the code and the tests can be re-
executed in order to ensure that the existing code is not being damaged.
6. Repetition:
This involves repetitions of the whole development cycle in order to improve functionality.
No comments:
Post a Comment