Subscribe by Email


Showing posts with label Test Driven. Show all posts
Showing posts with label Test Driven. Show all posts

Saturday, August 16, 2014

Test Driven Development - Some benefits

According to a study, test driven development involves writing more tests and thus makes programmers more productive. The hypotheses produced from the study were inconclusive regarding code quality and relation between productivity and TDD. Programmers that use the pure test driven development on projects said that they rarely felt like invoking the debugger. Version control system and TDD when used together, makes it easy to revert the code when it fails unexpectedly to the previous form that passed all the tests. Thus debugging here proves to be less productive than reverting.
TDD has more to offer other than just correctness validation. It can also be used for driving the designing process. Since the focus is shifted to the test cases, the programmer can see how the client will be using the functionality. As a result of this programmer’s concern with interface increases. This benefit of TDD is just the opposite of design by contract. It is so because we approach through test cases rather than using preconceptions and mathematical assertions.
With TDD you get the ability to proceed with programming in small steps with as much as you are comfortable with. Thus you are able to concentrate at the present task where your goal is to make the code pass the test. Initially in TDD, we are concerned with error and exception handling. There is a separate process for creation and implementation of these extraneous situations. This way it is ensured that at least one test covers each part of the code. The programmer’s and users’ confidence in the software is boosted.
Even though it is obvious that programming with TDD requires more code than with other techniques, according to a model by Müller and Padberg, implementation time in TDD is shorter. The defects are caught early because of the frequent testing in the development cycle. The errors are thus prevented from turning into expensive and endemic bugs. It also reduces the time period of debugging phase. The code produced with test driven development is more extensible, flexible and modular. This is by virtue of TDD’s methodology of forcing the programmers think in the terms of smaller code units. The benefit of all this is that you  get a cleaner, focused but loosely coupled code.
The modularization of the code to some extent is also affected by the design pattern of the mock objects used. This is so because the pattern requires writing the modules so as to make it easy to switch between versions for deployment and testing reasons. Every code path is covered by the automated tests unless no more code is required for the code to pass the test. For example, if the programmer wants to add an else branch to an if statement, then his first requirement is to write a code that causes that branching. That is why all the tests produced in TDD are quite thorough and even the most unexpected of the changes is detected.
It has been proved experimentally that TDD approach is superior to the tradition test – last approach when it comes to lower CBO (coupling between objects). The experiment also showed that TDD results in better modularization, easier testing and reuse of the already developed products. The effect of the TDD approach on generation of unit tests was measured using the MSI (mutation score indicator) and the BC (branch coverage). These indicate the effectiveness and thoroughness of the unit tests. A medium effect is represented by a mean effect size based up on the meta – analysis of the experiment that was performed. For branch coverage the effect size was medium and therefore taken to be substantive. 


Sunday, April 24, 2011

What is Test Driven Development Methodology and its benefits?

Test-driven Development(TDD)is a method of developing software that adopts a test
first approach plus refactoring. The test-first approach is a programming technique, involving analysis, design, coding and testing all together. Refactoring is used to improve the design of the code without changing the observable behavior of the software, it changes the internal structure. It is cleaning up the bad code. In test-driven development, each new test provides feedback into the design process which helps in driving design decisions.

WHAT ARE DIFFERENT BENEFITS OF TEST DRIVEN DEVELOPMENT


- It allows simple incremental development.
- It involves a simpler development process.
- It provides constant regression testing.
- It improves communication.
- It improves understanding of required software behavior.
- It centralizes knowledge.
- It improves software design.

WHAT ARE DIFFERENT STEPS IN TEST DRIVEN DEVELOPMENT


- Write a test that defines how the software should behave.
- Make the test run as easily and quickly as possible.
- Clean up the code.

After integration testing, the system is tested as a whole for functionality and fitness of use. It includes performance testing, stress testing, security testing, recovery testing.
In object oriented, test requirements are derived from analysis artifacts or work products that use UML such as the class diagrams,sequence diagrams and collaboration diagrams. Use case diagram is a good source to derive test cases. They represent high functionality. Use cases are not independent. They have sequential dependencies. A scenario is an instance of a use case, or a complete path through the use case.


Facebook activity