Traditional Culture Encyclopedia - Traditional stories - Why continuous integration?

Why continuous integration?

Before the application of continuous integration, the traditional development model was to divide the modules into modules at the beginning of the project, and then integrate them together for testing after all the codes were developed. With the development of software technology, various software methods have flourished, and the scale of software has increased.

It is also expanding, and software requirements are becoming more and more complex. Software can no longer be developed simply by dividing modules. It requires cooperation within the project. The disadvantages of the traditional model of dividing modules are becoming more and more obvious. Due to many bugs in the project

It existed in the early stage, and the problem was not discovered until the final integration. Developers need to spend a lot of time looking for the root cause of the bug during the integration phase. Coupled with the complexity of the software, the root cause of the problem is difficult to locate, and even the bottom layer has to be adjusted.

In terms of architecture, there are a lot of bug meetings at this stage. The content of the meetings is basically a discussion of how bugs are generated. In the end, it often develops into the leaders of different modules passing the blame to each other.

The biggest advantage of continuous integration is that it can avoid this traditional model of debug meetings during the integration phase.

Continuous integration advocates that the developers of the project frequently submit (check in) their changes to the source code to a single source code library and verify whether these changes have caused damage to the project. Continuous integration includes the following major points: Access to a single source code

A repository that keeps all source code in a single location (a source control system) where everyone can access the latest source code (as well as previous versions).

Supports automated creation scripts to completely automate the creation process, allowing anyone to complete system creation by entering only one command.

Testing is fully automated, requiring developers to provide self-testing code so that anyone can run a complete set of system tests by just entering a single command.

Provides master creation so that anyone can start master creation by entering just one command.

Developers are encouraged to frequently submit (check in) modified code.

The key to continuous integration is complete automation. Reading source code, compilation, connection, and testing, the entire creation process should be completed automatically.

For a successful creation, it is required that every step of the automation process cannot go wrong, and the most important step is testing. Only the creation that passes the test is a successful creation.

Creation in continuous integration is no longer as simple as traditional compilation and connection. Creation should also include self-testing. The self-testing code is submitted at the same time when the developer submits the source code. It is a unit test for the source code (derived from the practice of XP

), integrate all these self-test codes together to form a test set. After all the latest source code is compiled and connected, it must pass the test of this test set to be successfully created.

The main purpose of this kind of testing is to verify the correctness of the creation. McConnell calls it smoke testing. In continuous integration, this is called the integration acceptance test Build Verify Test, or BVT for short.

BVT testing is the basis of quality, the presence of BVT will not be felt by the QA team, they only test for successful creation (such as functional testing).

BVT testing should be as detailed as possible. Only through detailed testing can more problems be discovered, and the feedback results obtained will be more meaningful. All tests should be completed, so that the feedback results obtained are complete and not encountered.

If an error occurs, the testing process is abandoned.

Compared with daily creation, continuous integration also has the following characteristics: Continuous integration emphasizes the frequency of integration. Compared with daily creation, continuous integration appears to be more frequent. The currently recommended best practice is to integrate once every hour.

Continuous integration emphasizes timely feedback. The purpose of daily creation is to obtain a stable release version that can be used, while continuous integration emphasizes providing rapid feedback to developers after integration failure. Of course, the result of successful creation is also a stable version.

Rizhuang does not emphasize the frequency of developers submitting (checking in) source code, but continuous integration encourages and supports developers to submit modifications to the source code as soon as possible and receive feedback as soon as possible.

From the characteristics listed above compared with continuous integration and daily creation, it is obvious that the two words frequency and feedback appear particularly frequently. Continuous integration has a basic point that is counterintuitive, that is, the regular integration ratio

It's better to integrate occasionally.

Martin Fowler believes that for continuous integration, the more frequent the integration, the better the effect. If your integration is not done frequently (less than once a day), then the integration is a painful thing. If the integration is only done once in a while (a week or even

One month), waiting until the bug is discovered during the integration phase, and then finding the cause to solve the bug will cost you a lot of time and energy, and this method is a bit like the traditional integration model, which violates the original intention of continuous integration.