- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is Test Driven Development?
Test-Driven Development is also known as the TDD. It consists of the below steps to be followed one-by-one −
Step 1− Create a Test.
Step 2− Verify if the test fails.
If the test passes, create the second test.
If the test fails, then move to Step 3.
Step 3− Fix the test to make it pass.
If the test passes, move to Step 4.
If the test fails, then jump to Step 3.
Step 4− Start code refractor and redo all the above steps till the development is done.
Benefits of TDD
The benefits of TDD are listed below −
The developer is required to apprehend the requirements to know what the outcome of a scenario should be and how to test it.
The implementation for a module is done only if all the test cases pass and code refactoring is complete. Thus, verification and refactoring should be done before moving it to the next test.
After refactoring is done, the unit test suite is to run.
The unit tests can be used as live documentation.
If a bug is found, a test is created to get the details of the bug. The script is updated, to pass the tests. Simultaneously, the other tests are also executed to ensure that existing features are not broken by the fix.
A developer can participate in design decisions and improve it anytime during the test execution stage to ensure the application is working correctly. This is done to increase the maintainability of the product.
A developer is sure of making any modifications. This is because if that affects any existing feature, it shall be reflected by executing the tests. This way bugs can be addressed quickly.
On running the tests in succession all the prior bug fixes are also verified, and similar bugs can be avoided.
Since major testing is conducted during the development phase, the test duration required prior to delivery is short.
Drawbacks of TDD
The drawbacks of TDD are listed below −
The developers find it difficult to decide when to start testing.
The developers get confused about what to test.
The developers do not know if all the required specifications are being covered.
The developers are unsure if their code is adding business values.
Myths around TDD
The myths around TDD are listed below −
- Myth – TDD is only concerned with testing with automation.
Fact – TDD is a development technique following the Test First method.
- Myth – TDD does not consist of design.
Fact – TDD has thorough research and design depending on the requirements. The design was completed during the development phase.
- Myth – TDD is done only for unit testing.
Fact – TDD is done for system and integration testing as well.
- Myth – TDD cannot be adopted for orthodox test projects.
Fact – TDD is used for Agile development. But it can be adopted for conventional test projects as well.
- Myth – TDD is considered a tool.
Fact – TDD is a development technique and after every new unit test pass, it is clubbed with the automation suite which is run whenever there is a modification in the code and post refactoring activity.
- Explain Test Driven Development Framework.
- What is Keyword Driven Testing?
- What is Discovery-driven exploration?
- What is Java Development Kit (JDK)?
- What is the design of quality driven data warehouse?
- What is program development cycle in C language?
- What is a Test Scenario?
- What is Data-Driven Testing? Learn to Create a Framework
- What is Test analysis (Test Basis) in Software Testing?
- What is Cypress for Test Automation?
- What is Test Maturity Model (TMM)?
- State differences between Data Driven and Keyword Driven Framework.
- What is a test harness? (Tools, Examples)
- What is Configuration Testing? Example Test Cases