Java Unit Test

Source: Internet
Author: User

Steps:

1. First create a new project called Junittest, I write a student class, and then the student's gender, age unit test;

2. In the second step, the JUNIT4 unit test package is introduced 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 to the right of the "Library" tab, then on the far right to click on the button, Then select JUNIT4 and click OK in the new Popup dialog box.

3. Generate the JUnit test framework: In Eclipse's Package Explorer, right-click on the pop-up menu and select "Java test Case";

4. On the generated page, select ' New JUNIT4 test ', ' SetUp ' tab, click "Next", the system will automatically list the methods you include in this class, select "Student's gender, age test, then the system will automatically generate a new class studenttest, It contains a few empty test cases.

5. Finally, modify these test cases slightly, then right-click on the Studenttest class, select "Run as" and select "1 JUnit Test" to run, the test results indicate "run count 4, ignore 1, error 0,

Number of Failures 2 ", running results

Java Unit Test

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.