Introduction and application of JUnit

Source: Internet
Author: User
Tags xunit

1. Related Concepts

Øjunit: Is a Java Test framework for developing source code for writing and running repeatable tests. It is an instance of the Unit Test framework System Xunit (for the Java language). Mainly used in white box testing, regression testing.

Ø White Box test: Consider the test object as an open box, the logical structure inside the program and other information to the tester.

The clerk is public.

Ø regression testing: Software or environment repair or correction of the re-test, automated testing tools for such testing is particularly useful.

Ø Unit Test: A minimum 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.

2. Unit Test

2.1. The benefits of unit testing

Ø improve the development speed, the test is carried out in an automated manner, which improves the execution efficiency of the test code.

Ø improve the software code quality, it uses the iteration release to the integration, facilitates the realization personnel debugging. At the same time, the concept of refactoring is introduced to make the code cleaner and more resilient.

Ø 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

Ø process-oriented software development for processes.

Ø object-oriented software development for objects.

Ø 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 Unit test framework is the open source JUnit provided by Erich Gamma (author of design mode) and the founder of Kent Beck (Extreme programming).

3. Introduction to JUnit

3.1. JUnit benefits and JUnit Test authoring principles

Benefits of using JUnit:

Ø The test code can be separated from the product code.

Ø test code for one class can be applied to another class of tests with fewer changes.

Ø easy integration into the tester's build process, the combination of junit and ant can be implemented incrementally.

Øjunit is open source code, can carry out two times development.

Ø can be easily extended to JUnit.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.