Lab 1 Lab Report
First, Experimental Tasks
- Download JUnit (4.12), Hamcrest (1.3), and add that jar package to eclipse
- Install Eclemma on Eclipse to show coverage for your tests.
- Write a Java program to determine the shape of the triangle and JUnit to test the program.
A) to determine the description of the triangle problem:
The function that determines the triangle is passed in three parameters int a, int b, and int c to represent the three sides of the triangle. And calculate and judge that the triangles are equilateral triangle, isosceles triangle, and triangular triangles that are unequal to the three sides.
Second, Experimental Process
1. Download the Junit-4.12.jar and Hamcrest-all-1.3.jar two jar packages and add two packages to the create path.
2. Download and add Eclemma to eclipse. In Eclipse's help click Eclipse Marketplace, and search for Eclemma, click Install, wait for Eclipse to restart, select coverage as to run under run.
3. Create a project under SRC to create a package (Cn.tju.scs.Triangle), under which a Triangle class is built to determine the type of triangle. Under this project, create a source folder named Test, where you create a package with the same name under the SRC folder, under which a Testpara class is created to test the running results of the program.
4. Write a procedure for judging triangles and a test program.
5. Run the program, view the results of the test, and review the coverage to modify the test case.
Third, the experimental results
Experimental data test success, coverage 100%, such as:
ST:LAB1 Experiment Report (Test judgment Triangle edge length)