Java uses JUnit to do unit testing

Source: Internet
Author: User

A Definition of the class:

First create a project called F , define the Triangle class under the project , judge the triangle

Two JUnit Project Introduction

1. Introduce the JUnit unit test package to this project: on the project, right click on "Properties" to generate the following:

2 Select "java Build Path" First, then "libraries",then "Add Library ... " on the right. "

3 in the New Popup dialog box, select "JUnit", click Next, select Junit4 in the dialog box , click " Finish",the JUNIT4 software package is included in the F project.

Three

Generate the junit test framework and Select "junit test Case" in MyEclipse's file->new , set up a test1 class that holds the test code

Four Test code Results

(1) test result is isosceles triangle

(2) test result is equilateral triangle

(3) The test result is a normal triangle

4. The test result does not constitute a triangle

Five Record the time of each stage

Program plan:20%

Program Design:30%

Program code:30%

Program test:20%

Java uses JUnit to do unit testing

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.