What is test-driven development? (TDD)

Source: Internet
Author: User

I. What is TDD?

Simply put, before writing any functional code, write its test code. Procedure:
· Compile a test case as needed
· Write functional code to pass the test case
· Gradually add Test Cases
· Modify the function code so that the new test cases and the original ones both pass
· Refactoring, including functional code and Test Cases

Ii. Why TDD

Improve code quality. Thanks to the high quality and perfect test case set of function code, developers are more confident and can win the trust of others.

Improve the design. TDD ensures functional code testability, reduces coupling, improves component object models, and gradually improves the design during development.

Provides good documentation for functional code and maintains code and document synchronization. The agile Declaration advocates that the software that can run is better than all-around documents. A test case set is a document that is reliable and can run.

To some extent, it can replace program debugging. When each unit test focuses on each specific function, the problem is avoided earlier and better. In addition, debugging is manual and should not be repeated. The TDD test case set is automatically regression.

Effective Quality Control and project management. Managers can clearly understand the quality and development progress of projects through the results of unit tests on a daily basis.

Iii. TDD is a test and design.

When writing unit test code, it is actually under development. Before writing function code, design test cases from the perspective of function code users, and use the interface programming principles to reduce coupling and improve the design. It can be seen that TDD is also an object-oriented analysis, design, and development method. During the development of TDD, each class is tested separately, each part is designed and reconstructed frequently, and a complete set of testing cases is formed, TDD represents the process of continuous improvement and is an incremental design.

TDD (test driven development) is a testing technology and a design method. Its focus is not on test, but on development. It is an intent-driven software development method-intent programming.

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.