Software Testing: JUnit

Source: Internet
Author: User

1, what is JUnit

JUnit is a unit test framework for the Java language. Founded by Kent Beck and Erich Gamma, it became the most successful of the Xunit family of Sunit from Kent Beck. JUnit has its own JUnit expansion biosphere. Most Java development environments have integrated JUnit as a unit test tool.

JUnit is a regression testing framework (regression testing framework) written by Erich Gamma and Kent Beck. JUnit testing is a programmer's test, the so-called white-box test, because the programmer knows how the software being tested (how) accomplishes the function and what it does. JUnit is a set of frameworks that inherit the TestCase class and can be automatically tested with JUnit. [1]

2,. JUnit's test code writing idea

The test code in JUnit requires writing the test code before writing the code, and then writing the code and testing the code constantly in the idea-writing test code-programming-test, which reduces the amount of testing and modification and makes it easier to spot bugs.

If you test after you complete the code, it can be difficult to test or correct.

3,junit's trial

I started trying to install the JUnit 4.10.jar package, but since the environment variable configuration problem has not been successful, I saw in my blog that I was referred to as having inherited junit in eclipse, eliminating the hassle of configuring the library. So I did the following test [2]

4, Experience

1, the test case must be annotated with @test. @before is executed before each test method starts and is used for initialization, @after is executed after each test method is completed, and is used to clean up resources.

2, it is difficult to write test code, but this kind of thinking is very important to the programmer, I believe in the habit of writing test code for the future development will be a great help.

3, because Eclipse integrates JUnit and provides support for JUnit's operations, it is convenient to try JUnit in Eclipse.

Software Testing: JUnit

Related Article

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.