continuous integration

28
Continuous Integration Hugo

Upload: hugo-lu

Post on 10-Aug-2015

123 views

Category:

Software


0 download

TRANSCRIPT

Continuous IntegrationHugo

Questions• To developers: Do all the software components

work together if you commit this code? • To testers: Were all the tests successful after

the latest change? How long did you spend on those tests?

• To team leader: Were there any problems with the last development? When did you get the report?

• To managers: What’s the level of confidence in your team's capability to deliver working software.

What’sContinuous Integration (CI)

• A software development practice where members of a team integrate their work frequently.

• Each integration is verified by an automated build to detect integration errors as quickly as possible.

• This approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly.

Overview

Features of CI• By performing automated and continuous

compilation, database integration, testing, inspection, deployment, and feedback, your CI system can reduce common risks on your project, thus leading to better confidence and improved communication.

• “Build” is a set of activities performed to generate, test, inspect, and deploy software. • Private/system build • Integration build • Release build

Testing (Dynamic Analysis)• Automate unit tests • Automate component tests • Automate system tests • Automate functional tests • Categorize developer tests • Run faster tests first • Write tests for defects • Make component tests repeatable • Limit test cases to one assert

Inspection (Static Analysis)

• Quantitative analysis is better than qualitative analysis.

• Reduce code complexity (logic branch) • Perform design reviews (coupling) • Maintain organizational standards with code

audits • Reduce duplicate code • Assess code coverage

Code Complexity Review

Design Review

Code Standard Review

Code Duplication Report

Code Coverage Report

Deployment

• Produce a clean environment • Release working software any time, any place • Run all tests • Possess capability to roll back release • Label a repository's assets • Label each build • Create build feedback reports

Feedback• Getting the right information to the right

people at the right time and in the right way. • Right Information - Build Status, Inspection

Reports, Test Results. • Right People - Project Manager, Build Master,

Technical Lead, Developer, Business Analyst. • Right Time - When Problem Occurs Daily,

Weekly. • Right Way - E-mail, SMS, RSS, Sound/Light,

Browser plug-in, Instant Messenger, Widgets.

Practices of CI

• Write automated developer tests • Run private builds • Commit code frequently • Don’t commit broken code • Avoid getting broken code • Fix broken builds immediately • All tests and inspections must pass

CI Tools• CI tools/product • Build scripting • Version control • Database • Testing • Automated inspection • Deployment • Feedback • Documentation

Reducing Risks Using CI

• Risk is the potential for a problem to occur. • Lack of Deployable Software • Late Discovery of Defects • Low-quality Software • Lack of Project Visibility

“It Works on My Machine”

• Eliminating tight coupling between IDE and build processes • Use a separate machine solely for integration. • Ensure that everything to build the software is

contained in the version control repository. • Create a CI system to run the project build

script when it detects a change to the repository.

Not Synching with Database

• Database is not a separate entity from development • Place all database artifacts in your version

control repository. • Rebuild the database and data from the build

script. • Test (and inspect) database with database-

specific tests.

A Missing Click on Deployment

• Automate deployment process • Add deployment steps in the build scripts. • Run the build script continuously whenever a

change to the version control repository is applied.

Part-Regression Testing• Automate regression testing

• Write unit and component tests. • Write unit tests for the code that was changed,

based on defects. • Configure the build script to run all the unit

tests and publish a report for every build. • Tests are executed at every checkin to the

version control repository.

“Oops!Something Is Not Tested”

• Adopt Code coverage tools • Run a code coverage tool as a part of CI build

script when there is a change of version control repository.

“Did You Get the Memo?”

• Automatic communication • Configure CI server with the automated

mechanism that notify affected parties when a build fails.

Inability to Visualize Software

• Always have an up-to-date view • Generate UML diagrams of the design

automatically. • Generator documents of source code

automatically.

Coding Standard Not Followed

• Find out any violations of the coding standard • A one-page annotated class that contained all

of the coding standards. • Enforce the coding standard by using

automated inspection tools as a part of the build scripts.

Project Becomes a “Big Ball of Mud”

• Continually monitor the software architecture • Add automated inspection tools to assess

adherence to the project’s architectural standards.

• Run a tool such as this with every integration build.

Duplicate Code• Continually monitor and reduce code

duplication • Analyze the code using a code duplication

analyzer. • Reduce the duplicated code by refactoring the

code into a single method or component. • Run code duplication inspections continuously

in CI system.

Value of CI

• Reduce risks • Reduce repetitive manual processes • Generate deployable software at any time and

at any place • Enable better project visibility • Establish greater confidence in the software

product from the development team