Extreme Programming
The cornerstone of http://www.answers.com/topic/extreme-programming - Extreme Programming (XP) is the unit test. XP relies on an
automated http://www.answers.com/topic/list-of-unit-testing-frameworks - unit testing framework . This automated unit testing framework
can be either third party, e.g. http://www.answers.com/topic/xunit - xUnit , or created within the development group.
Extreme Programming uses the creation of unit tests for http://www.answers.com/topic/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://www.answers.com/topic/code-refactoring - refactoring , simplified code integration, accurate documentation, and
more modular designs. These unit tests are also constantly run as a form of http://www.answers.com/topic/regression-testing - regression
test .
Techniques
Unit testing is commonly http://www.answers.com/topic/test-automation - automated , but may still be performed manually. As with many
reputable standards bodies, the http://www.answers.com/topic/ieee - IEEE http://www.answers.com/topic/unit-testing#wp-_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://www.answers.com/topic/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 through http://www.answers.com/topic/code-refactoring - refactoring , or if necessary,
re-design.
Using a unit testing framework, the developer codifies criteria into the unit test to verify the correctness of the unit under
test. During execution of the unit test(s), the framework logs test cases 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://www.answers.com/topic/coupling-computer-science - decoupled and http://www.answers.com/topic/cohesion-computer-science - cohesive code bodies.
This practice promotes healthy habits in software development. http://www.answers.com/topic/design-pattern-computer-science - Design
patterns , unit testing, and refactoring often work together so that the most ideal solution may emerge.
|