Print Page | Close Window

Unit Testing Applications

Printed From: One Stop Testing
Category: Types Of Software Testing @ OneStopTesting
Forum Name: Unit Testing @ OneStopTesting
Forum Discription: Discuss All that is need to be known about Unit Software Testing and its Tools.
URL: http://forum.onestoptesting.com/forum_posts.asp?TID=557
Printed Date: 30Jun2024 at 7:36am


Topic: Unit Testing Applications
Posted By: priyanka
Subject: Unit Testing Applications
Date Posted: 03Apr2007 at 1:40am

Extreme Programming:

The cornerstone of http://en.wikipedia.org/wiki/Extreme_Programming - Extreme Programming (XP) is the unit test. XP relies on an automated http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks - unit testing framework . This automated unit testing framework can be either third party, e.g. http://en.wikipedia.org/wiki/XUnit - xUnit , or created within the development group.

Extreme Programming uses the creation of unit tests for http://en.wikipedia.org/wiki/Test_Driven_Development - Test Driven Development . The developer writes a unit test that exposes either a software requirement or a defect. This test will fail because either the requirement isn't implemented yet, or because it intentionally exposes a defect in the existing code. Then, the developer writes the simplest code to make the test, along with other tests, pass.

All classes in the system are unit tested. Developers release unit testing code to the code repository in conjunction with the code it tests. XP's thorough unit testing allows the benefits mentioned above, such as simpler and more confident code development and http://en.wikipedia.org/wiki/Refactoring - refactoring , simplified code integration, accurate documentation, and more modular designs. These unit tests are also constantly run as a form of http://en.wikipedia.org/wiki/Regression_test - regression test .


Techniques:

Unit testing is commonly http://en.wikipedia.org/wiki/Test_automation - automated , but may still be performed manually. The http://en.wikipedia.org/wiki/Institute_of_Electrical_and_Electronics_Engineers - IEEE http://en.wikipedia.org/wiki/Unit_test#_note-0 - [1] prescribes neither an automated nor a manual approach. A manual approach to unit testing may employ a step-by-step instructional document. Nevertheless, the objective in unit testing is to isolate a unit and validate its correctness. Automation is efficient for achieving this, and enables the many benefits listed in this article. Conversely, if not planned carefully, a careless manual unit test case may execute as an integration test case that involves many software components, and thus preclude the achievement of most if not all of the goals established for unit testing.

Under the automated approach, to fully realize the effect of isolation, the unit or code body subjected to the unit test is executed within a http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks - framework outside of its natural environment, that is, outside of the product or calling context for which it was originally created. Testing in an isolated manner has the benefit of revealing unnecessary dependencies between the code being tested and other units or data spaces in the product. These dependencies can then be eliminated.

Using an automation framework, the developer codifies criteria into the test to verify the correctness of the unit. During execution of the test cases, the framework logs those that fail any criterion. Many frameworks will also automatically flag and report in a summary these failed test cases. Depending upon the severity of a failure, the framework may halt subsequent testing.

As a consequence, unit testing is traditionally a motivator for programmers to create http://en.wikipedia.org/wiki/Coupling_%28computer_science%29 - decoupled and http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 - cohesive code bodies. This practice promotes healthy habits in software development. http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 - Design patterns , unit testing, and refactoring often work together so that the most ideal solution may emerge.





Print Page | Close Window