Continuous
Integration
1.
“It works
on my
Risk 1
Lack of Deployable
Software
Risk 2
9 © 2011 CTG, Inc.
10 © 2011 CTG, Inc.
Risk 3
Risk 4
All these risks are related to
Old School Development
Version Control System Lead Developer Developer Developer Commit Code Builds sources Write Code Write Code Write Code Get latest sourcesManual
Effort
Slow
Feedback
Debugging
19 © 2011 CTG, Inc.
Build software
Development
practice
where
team
members integrate their work
daily
verified by
automated
builds
using different
testing
types
Development
practice
where
team
members integrate their work
daily
verified by
automated
builds
using different
testing
types
3 building blocks
of continuous
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
7 Principles of
Continuous
Check in at least once
a day
Small Steps are beter
than one big leap
Check in after each
task
Avoid the 5PM check
in mess
we can check in as often
as we want…
Continuous Integration
without testing
=
1.
Commit code frequently
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
1.
Commit code frequently
2.
Write automated unit tests
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
1.
Commit code frequently
2.
Write automated unit tests
3.
Run private builds
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
1.
Commit code frequently
2.
Write automated unit tests
3.
Run private builds
4.
Don’t commit broken code
You Break It
(The Build)
You Buy It
(Round of Beer)
You Fix It
(Quickly)
1.
Commit code frequently
2.
Write automated unit tests
3.
Run private builds
4.
Don’t commit broken code
5.
Fix broken build immediately
1.
Commit code frequently
2.
Write automated unit tests
3.
Run private builds
4.
Don’t commit broken code
5.
Fix broken build immediately
6.
Avoid getting broken code
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
</CODE>
Development
practice
where
team
members integrate their work
daily
verified by
automated
builds
using different
testing
types
one team
one team
Developers
Testers
Development
practice
where
team
members integrate their work
daily
verified by
automated
builds
using different
testing
types
UI
Service/API
Unit
Test Execution Time1 Unit – 99,5% reliable
1 system = 50 Units
About Unit Testing
■
Verify behavior of small elements in a software system,
most often a single class
■
Occasionally more than 1 class in case of tightly coupled
classes
■
No connections to DB, filesystem,…
■
Code Coverage per test is generally limited
■
Should be very fast
■
Crucial Component of CI, unit tests run in every build
Where in CI?
VCS CI Server Developer Feedback Mechanism Commit Code + Unit Tests Polls for changes Builds sources Unit Tests Build Server78 © 2013 CTG, Inc.
Build the code RIGHT
About Unit Integration/Acceptance Testing
■
Also a white box test
■
May cross architectural boundaries
■
More code coverage per test
■
Longer running duration than Unit Tests
Where in CI?
VCS CI Server Developer Feedback Mechanism Commit Code + Unit Tests Polls forchanges Builds sources
Unit Tests Send Feedback Unit Integration Tests Commit Build (Lightweight) Secondary Build (Heavyweight) If Commit Build Succesful
JUnit
NUnit
MS Tests
TestNG
DBUnit
Some Namedropping
Unit
Performance
Testing
85 © 2013 CTG, Inc.
86 © 2013 CTG, Inc.
Where in CI?
VCS CI Server Developer Feedback Mechanism Commit Code + Unit Tests Polls forchanges Builds sources
Unit Tests Send Feedback Unit Integration Tests Commit Build (Lightweight) Secondary Build (Heavyweight) If Commit Build Succesful Unit Performance Tests
JUnitPerf
JUnitBench
ContiPerf
NUnitPerf
API/Service
Testing
Run Test Case
Fixture
The actual Code
Run Test Case
Fix Code
Run Test Case
Refactor Code
FitNesse
Cucumber
Concordion
SOAPUI
JMeter
HP ServiceTest
Some Namedropping
Where in CI?
VCS CI Server Developer Feedback Mechanism Commit Code + Unit Tests Polls forchanges Builds sources
Unit Tests Send Feedback Unit Integration Tests Commit Build (Lightweight) Secondary Build (Heavyweight) Unit Performance Tests Service/API Tests
We’re not done yet!
• Selenium
• HP Unified Functional Testing - FASTBoX • MS Coded UI Testing
GUI Automated Testing
• JMeter
• HP LoadRunner • MS Visual Studio • RadView WebLoad
E2E Performance Testing
• HP WebInspect • HP QAInspect
Where in CI?
VCS CI Server Developer Feedback Mechanism Commit Code + Unit Tests Polls forchanges Builds sources
Unit Tests Send Feedback Unit Integration Tests Commit Build (Lightweight) Secondary Build (Heavyweight) Unit Performance Tests Nightly Build Service/API Tests GUI Automated E2E Performance Dynamic Security
Mapping Tests
on Build Types
Builds Strategy
• Unit Tests
Lightweight Commit Build
• Unit Integration • Unit Performance • API/Service Test
• Automated UI Smoke Tests
Secondary Build (Heavyweight)
• Automated UI Tests • Static Testing
• Static Application Security Testing • Dynamic Application Security Testing
Nightly Build
• Automated UI Tests • Manual Tests
Manual Testing
& CI
one team
Developers
Testers
one team
Developers
Reduce project
Reduce
repetitive
Generate
deployable
Remember our
project risks?
Lack of Deployable Software
Risk 1
Lack of Project Visibility
Lack of Deployable Software
Risk 1
Heatmap with LoC (Size), and Code Coverage (Color)
Lack of Project Visibility
Lack of Deployable Software
Low Structural Quality
Risk 1
Risk 2
Level of Code Duplication
Lack of Project Visibility
Lack of Deployable Software
Low Structural Quality
Late Discovery of Defects
Risk 1
Risk 2
Risk 3
Builds Strategy
• Unit Tests
Lightweight Commit Build
• Unit Integration • Unit Performance • API/Service Test • UI Smoke Tests
Secondary Build (Heavyweight)
• E2E Performance Testing • Static Testing
• Static Application Security Testing • Dynamic Security Testing
Non-Functional Build (Nightly/Weekly)
• Manual Testing • UI Tests
Lack of Project Visibility
Lack of Deployable Software
Low Structural Quality
Late Discovery of Defects
Risk 1
Risk 2
Risk 3
139 © 2013 CTG, Inc.