Code Driven Testing is also known as the Test Driven Development (TDD). Code Driven testing is key feature of the Agile testing. Code driven testing is one way to think over the design before developing the code.
The use of testing framework such as XUnit framework is increasing as there is growing trend in software development. x unit is the framework which allows the different elements to be tested such as the class, functions, etc.
Code driven testing is a subtype of the unit testing which analyses that the code is based on specific rules and standards. The main focus of this kind of testing is testing the code.
In Code driven kind of testing Unit tests are written before writing the code. The code is said to be correct when all the tests passes successfully.
The first step of development is to add the test which is close enough to fail the code. If the code fails then the next step is to execute the complete test which is again enough to fail the code. In the third step the code is updated to pass the new test. Now if the test again fails then we need to update the code and retest it, if the test passes successfully then the same process is continued for the next development phase.
- As the tests are written before the code, the bugs are easier to find.
- Makes the developer to find the defects and bugs in the earlier stages.
- Tests makes the code much easier to understand.
- Difficult to write the good test cases which will cover all the essential requirements.
- Needs much effort and time is needed to maintain the test cases suits.