Discovering code structure problems through UT

Source: Internet
Author: User

Through ut for a period of time, it is found that UT is not only used to guaranteeCodeIn addition to the correct logic, it can also be used to discover the design defects of the Code. Of course, this is not to discover design defects by running ut, but to write ut. Instead of using a test-driven development model, we write some code to do ut. In this way, if you find that ut for a piece of code is difficult to write, it usually means that the design of this piece of code has the following: the interface is not clear enough, the class responsibility is not clearly divided, and the source file has unnecessary compilation dependencies .... To put it bluntly, it is a "testability" problem. This sensitivity should be maintained when writing ut, and such design problems should be found and corrected in a timely manner.

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.