The use of JUnit is through this article (http://dev.yesky.com/softchannel/72342371/18882557.SHTML), trying to have done it, and the results found that the code example provided above is Wrong, but the process, the picture is very clear. So you can look at what it is above it first, as for the test code, I made a little change, for example, as long as you explain the problem - it is not difficult. Test class code: public class hellojunit {public static int abs (int N) {return n> = 0? N: (- n);}} JUnit test code: import junit.framework.testcase; public class hellojunittest Extends Testcase {public void Testabs () {Assertequals (Hellojunit.abs (10); Assertequals (Hellojunit.abs (-10), 10);}} The main code behavior assertequals (Hellojunit.abs (10), 10); The meaning of the parameters is that hellojunit.abs (10) performs the ABS method (parameter 10, indicating the absolute value of 10). 10 of the comma is expressed as the expected result (expected value). This line represents comparing the expectation value (10) with the actual value (the result of the ABS method of the class Hellojunit), if it is not equal, throw an exception. Here is just a simple example, JUnit is called an excellent white box automation test framework, of course, only you have used it. There are a lot of information on the Internet to introduce this framework, and the author has sent it from its own situation. Of course, learning is required to have a certain basis. The author has the foundation of C and C . Soon after Java's learning, the knowledge you can share will be shared here, hoping to be able to improve together. In addition, the author is a full-time tester, so most of which will be described in the perspective of testing. The purpose of learning this framework is to perform white box testing in the work. In the later introduction, the theoretical and tools related to white box testing are introduced, I hope everyone can improve progress together.