3. Test Driven Development (TDD) is a software development practice that
focuses on creating unit test cases before developing the actual code.It is an
iterative approach that combines programming, the creation of unit tests, and
refactoring.
3 Phases of Test Driven Development :--
1) Create Precise Tests - Developers need to create precise unit tests to
verify the functionality of specific features.
2) Correcting The Code -Once a test fails, developers need to make the
minimal changes.
3) Refactor The Code -Once the test runs successfully, check for
redundancy or any possible code optimizations.
4.
5. Frameworks for Test Driven Development
Based on unique programming languages, there are multiple frameworks that
support test driven development, these are:--
1) csUnit and NUnit – Both are open source unit testing frameworks for .NET
projects.
2) PyUnit and DocTest - Popular Unit testing framework for Python.
3) Junit - Widely used unit testing tool for Java.
4) TestNG - Another popular Java testing framework. This framework
overcomes the limitations of Junit.
5) Rspec - A testing framework for Ruby projects.
6. How TDD fits into Agile development?b
Agile Development demands regular feedback to develop the expected
product, therefore, is also termed as Feedback Driven Development.
There’s a high probability that project requirements may change during the
development sprint cycle. To deal with this and to build products aligned with
the client’s changing requirements, we need constant feedback to avoid
unusable software. TDD is built to offer this feedback at the earliest.
7. ADVANTAGES OF TDD
Test Driven Development (TDD) is a software
development practice that focuses on creating unit test
cases before developing the actual code
1. Better program design,higher code quality - Developers write
the necessary tests, and the code, to avoid all the failures. Consequently, the
code appears to give better results.
2. Detailed project documentation -writing tests for particular
requirements, includes all the likely users’ actions.
3. It reduces the time required for project development -
when tests fail,where they should pass,developers understand immediately
,therefore it saves time during project development phase.
8. continued ...
4. High test coverage -There’s a test for each feature.
5. With TDD we will get a reliable solution - Tests help to understand if
everything goes right after adding a new feature.
6. Save project costs in the long run - Quality of the project will
significantly be higher.
7. Reduction in bugs - Since we are doing test first,so fewer bugs, hence we
will spend less time to fix them.
8. Avoids duplication of code.
9. DISADVANTAGES OF TDD
1. Early Test cases created ,are heavy in maintenance.
2. Tend to write test cases which may not be needed.
3. Creating Test cases for failures can be tedious.
4. Requirement changes is paid.
10. Statistics showing costs of code maintenance created
without TDDtics showing costs of code maintenance
created without TDD.