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