Using JUnit for method testing in idea

Source: Internet
Author: User
1. The preceding article

The new skills you've just learned, the knowledge of JUnit is also a fur level, and take notes here. If the great God has a more complete or more convenient use of the operation, I hope to share, we study together: 2. Body 2.1 Environment

Idea 14.1.7 Version 2.2 Scenario Settings

Existing A class Studentdaoimpl, there are the following methods

public class Studentdaoimpl implements Istudentdao {public
    void Save (Student Student) {//Save logic ...}
    public void Update (Student Student) {//update logic ...}
}

question: How do you use JUnit tests for this class? --as shown in the figure: 2.3 Use process as diagram operation

Or you can use shortcut keys in this class page: Ctrl+shift+t, the effect is the same. As shown in the figure

Click Test to eject the following box

Click OK and idea will automatically help us create the test class code

Write good test code and run test methods. As shown in figure

Finally click Run ' method name ' to execute the test method.

Reprint please indicate the source: http://blog.csdn.net/czd3355/article/details/53572989

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.