JUnit Five Minute Master

Source: Internet
Author: User
What is JUnit?

JUnit is a framework for unit testing that makes it easy for programmers to perform unit tests quickly and efficiently during the development process.


Why unit Testing?

Many programmers think that it is time consuming to write a lot of unit tests during the development process. In fact, this idea is very sighted. You know, more time-consuming than development is debugging, if you can reduce the number of bugs in the development process, it can greatly shorten the development cycle, and develop more high-quality code.


Why not use the main function for unit testing?

JUnit provides assertions! The ability to enter expected results when testing a function, and JUnit will automatically determine whether the test function runs in accordance with the expected results.


What are the error types for JUnit?

JUnit's errors are in two cases: error and failures.

The error indicates that the code for the test function is problematic, and failures indicates that the function being tested runs correctly, but the output does not match the expected result.


Introduction to JUnit's common annotations



Use of the JUnit suite



JUnit parameterization Settings

Before using assertions in a test function to compare only one value with the result, the parameter session settings can improve the efficiency of the test by comparing a set of values and the results of the function running consistently.





The best implementation of JUnit


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

JUnit Five Minute Master

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.