Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

33
Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions

Transcript of Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Page 1: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Improving Software Quality with Continuous Integration

Chris FarrellQuick Solutions

Page 2: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Questions Anytime

• Ask questions whenever you want

Page 3: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

What is CI?

• NOT a software program you install• NOT something you buy or pay for• NOT a new idea• NOT specific to .Net or Java• Is a set of process best practices applied during

development to– Reduce defects by doing QA during development– Improve productivity by automating manual tasks– Facilitate collaboration and teamwork

Page 4: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Who Created Continuous Integration

Page 5: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.
Page 6: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Why Do CI?

Source: http://www.riceconsulting.com/public_pdf/STBC-WM.pdf

Page 7: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Problems solved with CI

• Integration Hell• Difficult, Stressful

deployments• Human Error in Deployments• Late feedback from QA

Page 8: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Benefits of CI

• Reduced Cost• Improved Quality• Stable velocity• Easy, more accurate/consistent deployments• Can demo at any time• Can deploy at any time• Improved Transparency

Page 9: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

#1 – Single Source Repository

• Everyone works from the same codebase *during* development

• Repository contains *all* needed files including SQL Scripts, Reports, Code, Dependencies, etc

• Tools: VSS, CVS, SVN, GIT, TFS,etc

Page 10: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

#2 Automate the Build

• Make it so that anyone can build with a single command

• Build could involve multiple projects and dependencies– Multiple project build

• Automated Build should be able to build pieces AND the whole

Page 11: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Build Triggers

• Manual Build• Build on Check-In– CI server detects check-ins and triggers build

• Scheduled Build– Nightly Builds

Page 12: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

#3 Make the Build Self Testing

• Does the latest version compile?• Quality Metrics – Performance, Test Coverage• Automated Tests– FX Cop Style Guidelines– UI/Functional Tests– Integration Tests– Unit Tests

Page 13: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

#3 Tooling

• Build Tools– MS Build, Nant, Rake, Maven

• Unit Testing– Resharper, Nunit, MS Test, Gallio/MBUnit, etc

• Functional Testing– SpecFlow, Cuke4Nuke

• UI Testing– Microsoft Test Manager, WATIN, Selenium

Page 14: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

#4 – Everyone Commits to the mainline every day

• “Mainline” does not mean prod• Typically you commit multiple times per day• Commit at least at end of day in case someone

is sick, a hard drive dies, workload shifts, etc• Anyone can get the latest code at any time• Provides support for versioning

Page 15: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

#5 – Every Commit Should Build on an Integration Machine

• Ensures that all code to build the project has been checked in to source control

• Doesn’t need to be a high end PC. Can be a VM or an obsolete dev machine

Page 16: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

#6 – Keep the Build Fast

• The entire point of CI is to provide fast and frequent feedback

• If the build is broken, you want to find out before someone else checks out broken code

• Short feedback cycles• For slow builds..prestage when needed

Page 17: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

#7 – Test in a Clone of the Production Environment

• Should be a close as possible. Every difference is a risk that what works in QA will not work in Production

• Might involve testing on multiple targets• Should have similar– Database size– Quality of Test Data– Network Security Configuration– Server and Client Software

Page 18: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Database

Deploy to Production

Backup Database from

Prod

Copy Database to CI Server

Restore DB each build

Apply Migrations

Page 19: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

#8 – Make it Easy for Anyone to Get the Latest Executable

• Business Analyst should be able to do Show & Tell at any time

• QA should be able to test at any time– QA can trigger builds

• Sales should be able to see current version

Page 20: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

#9 – Everyone can see what is happening

• CI is about feedback and transparency• CI should provide visibility towards– Is the Build broken– Who checked in code, when, for what feature– Code Quality Metrics• Automated Test Results• Code Coverage• Performance Metrics

Page 21: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

#10 Automate Deployment

• When you have to deploy at 5pm on Friday or 6am on Monday

• So your QA testers can test without asking you if the latest version is out

Page 22: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

#10 – Automate Deployment

• CRITICAL– Deployment is a deliverable that needs to be

tested before deploying to production– Speed of Deployment– Labor Cost of Deployment– Accuracy of manual deployments– non-tech users must be able to deploy to test – target multiple environments for testing

• Greatly reduces deployment stress

Page 23: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

#10 – Automate Deployment

• Automate *all* of deployment– Backup of Production– Database updates– Data Migrations– Code Deployment– Report Deployment

• Practice makes perfect!!!

Page 24: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Other Uses/Benefits

• Can use CI to automate almost anything– Data Migration Jobs– Backup local or remote data/files– Send Reports – Reset environments– Sync environments(ex move AD from Prod to Dev)

Page 25: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Selling CI

• Issue – Time/Cost to Setup• Issue – No access for automated deploy due to

politics/firewall• Issue – Sensitive data• Issue – Limited access to dev environment

Page 26: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Free VCS

• www.unfuddled.com– 200 mb free SVN & GIT

• www.gitHub.com– Free for public repositories/OSS

• www.assembla.com– Free private GIT repos(?2gb limit?)

• www.CodePlex.com– free TFS for OSS

• http://code.google.com/projecthosting/– 2gb GIT, Mercurial, SVN

• www.sourceforge.com

Page 27: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Popular CI Servers

– Hudson (Free)• http://hudson-ci.org

– Jenkins (Free)• http://jenkins-ci.org

– TeamCity (sort of free)• www.jetbrains.com/teamcity/• Free up to 20 build configurations/3 agents

– CruiseControl.Net (free)• http://cruisecontrol.sourceforge.net

– Team Foundation Server• Included with MSDN Pro and higher

Page 28: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Build Automation Tools

• MS Build– C:\

• Nant (port of Ant)– http://nant.sourceforge.net

• Rake(Ruby Make)– http://rake.rubyforge.org

Page 29: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Other Tooling

• SSRS Report Deployment– https://github.com/chrispfarrell/RsDeploy

• DB Comparision– Visual Studio 2010 Database Projects– RedGate SQL Compare($395)

• FluentMigrator

Page 30: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

TFS Demo

• Work Item Tracking• Source Control• Project Mgmt Charts• CI Build– Unit Tests– Integration Tests

• Automated Deployment

Page 31: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Jenkins Demo

Page 32: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

QSI is Hiring

Page 33: Improving Software Quality with Continuous Integration Chris Farrell Quick Solutions.

Chris Farrell

• Website: www.chrispfarrell.com• Twitter: @chrispfarrell• Email: [email protected]