Directory
1. Definition of class:
Use of 2.Junit tools:
3. Unit test the class and view the results:
4. Record the time of each stage
5. Record the process on your personal blog (GitHub address)
1. Class definition: A class is a generic term for the same thing, a class is a carrier of the properties and behavior of the encapsulated object, and conversely, a class of entities with the same properties and behavior is called classes.
Use of 2.Junit tools:
The first step
First create a new project called Suxin, we write a class , this is a simple implementation of the addition of the Calculator class, and then the function of the monomer test.
The second step is to introduce the JUNIT4 Unit test package into this project: Right-click on the item, click "Properties",\ in the pop-up Properties window, first select "Java Build Path" on the left, then go to the top right to select " Libraries"tag, then on the far right click on the"Add Library ... "button, as shown in :
Then, in the New Popup dialog box, selectjunit4junit4
third step, generate junit test framework: in eclipse package Explorer< Span style= "font-size:large;" Right click on the pop-up menu and select "new à junit Test case ". As shown:
After clicking "Next", the system will automatically list the methods contained in your class and choose the method you want to test. In this example, we only test the "plus" method.
The system then automatically generates a new class classtest, which contains some empty test cases. I just need to make these test cases a little bit of modification to use.
The results of the operation are as follows:
4. Record the time of each stage
Program Schedule 15 minutes
Programming 20 minutes
Program code 10 minutes
Program Test 30 minutes
Java uses JUnit tools for unit Testing