Index: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Home > Unit test
In computer programming, a unit test is a method of testing the correctness of a particular module of source code. The idea is to write test cases for every non-trivial function or method in the module so that each test case is separate from the others if possible.
1 Benefits
The goal of unit testing is to isolate each part of the program and show that the individual parts are correct. It provides a written contract that the piece must satisfy. This isolated testing provides two main benefits:
- 1. Encourages change
- Unit testing allows the programmer to refactor code at a later date, and make sure the module still works correctly ( regression testing). This provides the benefit of encouraging programmers to make changes to the code since it is easy for the programmer to check if the piece is still working properly.
- 2. Simplifies Integration
- Unit testing helps eliminate uncertainty in the pieces themselves and can be used in a bottom-up testing style approach. By testing the parts of a program first and then testing the sum of its parts will make integration testing easier.
2 Limitations
It is important to realize that unit-testing will not catch every error in the program. By definition, it only tests the functionality of the units themselves. Therefore, it will not catch integration errors, performance problems and any other system-wide issues. Unit testing is only effective if it is used in conjunction with other software testing activities (see Software testing under Software testing activities).
3 Applications
The unit testing concept is part of the Extreme Programming method of software engineering. Various unit testing frameworks, based on a design by Kent Beck, have come to be known as xUnit testing frameworks and are available for many programming languages and development platforms. Unit testing is the building block to test driven development (TDD). Extreme Programming and most other methods use unit tests to perform black box testing.
Note that the Extreme Programming community has renamed unit tests to "programmer tests".
The D programming language offers direct support for unit testing.
4 See also
- JUnit - a unit testing module for JavaJava is an object-oriented programming language developed primarily by James Gosling and colleagues at Sun Microsystems. The language, initially called Oak (named after the oak trees outside Gosling's office), was intended to replace C++, although the fea
- PyUnitPyUnit is the standard unit testing framework module for Python, described as a Python version of JUnit. It is now part of Python's standard library. External link . Because PyUnit is part of the standard library now, this link is mostly for historical in - a unit testing module for PythonPython is an interpreted, interactive programming language created by Guido van Rossum in 1990, originally as a scripting language for Amoeba OS capable of making system calls. Python is often compared to Tcl, Perl, Scheme, Java and Ruby. Python is develo
- NUnitNUnit is an open source unit testing framework for Microsoft. It serves the same purpose as JUnit does in the Java world. Literature Bill Hamilton: NUnit Pocket Reference''. O'Reilly, Cambridge 2004 BooksEnthsiast.com See also Unit Test External link Soft - a unit testing module for Microsoft .NETNET (note capitalization) initiative is a Microsoft project to create a new software development platform focused on network transparency, platform independence, and rapid application development. The strategy . NET is Microsoft's strategic initiative for
Read more »