Software testing on-machine jobs

Source: Internet
Author: User

The installation of JUnit, Hamcrest, and Eclemma.

1.junit and Hamcrest add Junit-4.12.jar and Hamcrest-all-1.3.jar in build path by adding external jars after creating a new JUNITHW1 project.

2.eclemma Click Help-eclipse Marketplace-find-eclemma Install under Eclipse to restart Eclipse.

Second, the programming judgment triangle is equilateral triangle, isosceles triangle or not equilateral triangle.

 Public classTriangle {Private Static intError = 0; Private Static intEquilateral = 1; Private Static intIsosceles = 2; Private Static intScalene = 3;  Public Static intTriangletype (intAintBintc) {        if(A <= 0 | | b <= 0 | | c <= 0){             return0; }Else if(A + B > C && a + C > B && B + C >a) {                if(A = = b && b = =c) {System.out.println ("This is a equilateral triangle."); return1; }Else if(A = = b | | a = = c | | b = =c) {System.out.println ("This is a isosceles triangle."); return2; }Else{System.out.println ("This is a scalene triangle."); return3; }        }Else{            return0; }    }        }

To create a test class

 Public classTriangle {Private Static intError = 0; Private Static intEquilateral = 1; Private Static intIsosceles = 2; Private Static intScalene = 3;  Public Static intTriangletype (intAintBintc) {        if(A <= 0 | | b <= 0 | | c <= 0){             return0; }Else if(A + B > C && a + C > B && B + C >a) {                if(A = = b && b = =c) {System.out.println ("This is a equilateral triangle."); return1; }Else if(A = = b | | a = = c | | b = =c) {System.out.println ("This is a isosceles triangle."); return2; }Else{System.out.println ("This is a scalene triangle."); return3; }        }Else{            return0; }    }        }

Third, test results

Software testing on-machine jobs

Related Article

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.