1. Several related concepts
White box test-Consider the test object as an open box, and the logical structure and other information inside the program is open to the tester.
Regression testing-A "re-test" of software or environment fixes or corrections, which are particularly useful for such tests.
Unit tests-A minimal granularity test to test a feature or block of code. It is generally done by programmers because it needs to know the details of internal programming and coding.
junit--is a Java test framework for developing source code for writing and running repeatable tests. He is an example of the Xunit for the Unit Test framework system (for the Java language). Mainly used in white box testing, regression testing.
2, Unit Test overview
2.1. The benefits of unit testing
A, improve development speed-testing is done in an automated manner, improving the efficiency of test code execution.
B, improve the quality of software code-it uses a small version of the release to integration, to facilitate the implementation of personnel debugging. At the same time, the concept of refactoring is introduced to make the code cleaner and more resilient.
C, to enhance the reliability of the system-it is a regression test. Support repair or correction of "re-test" to ensure the correctness of the code.
2. 2, unit test for the object
A, process-oriented software development for the process.
B, object-oriented software development for the object.
C, you can do class testing, functional testing, interface testing (most commonly used in the test class methods).
2.3. Unit testing tools and frameworks
The current most popular unit testing tool is the Xunit Series framework, commonly used according to language differences into JUnit (Java), CppUnit (c + +), Dunit (Delphi), NUnit (. net), PhpUnit (PHP) and so on. The first and most outstanding application of the test framework is the open source JUnit provided by Erich Gamma (author of design mode) and the founder of Kent Beck (Extreme programming).
3.Junit Introductory Introduction
3.1. JUnit Benefits and JUnit Unit Test authoring Principles
Benefits:
A, you can separate the test code from the product code.
B, test code for a class can be applied to another class's tests with fewer changes.
C, easy integration into the tester's build process, the combination of junit and ant can be implemented incrementally.
D, JUnit is open source code, can carry out two times development.
C, you can easily extend JUnit.
Writing principles:
A, is to simplify the preparation of the test, which includes the learning of the test framework and the preparation of the actual test unit.
B, is to keep the test unit persistent.
C, it is possible to use existing tests to write related tests.