continuous integration - uzh ifi · 2016. 6. 23. · continuous integration 12 > establish...

29
Multi-Stage Builds for Quality Assurance Continuous Integration Dr. Beat Fluri Comerge AG

Upload: others

Post on 20-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

Multi-Stage Builds for Quality Assurance

ContinuousIntegration

Dr. Beat FluriComerge AG

Page 2: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

ABOUTMSc ETH in Computer ScienceDr. Inform. UZH, s.e.a.l. groupOver 8 years of experience in object-oriented software engineering with JavaSpecial focus on Java EE 6

2

Page 3: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

> V-Model

> Continuous Integration

> Example JEE RESTful application

> Multistage Builds for V-Model

3

Roadmap

Page 4: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

V-Model

4

User needs

System Spec

SubsystemDesign/Spec

UnitDesign/Spec

Unit

Subsystem

System

Delivery

Specification Implementation

Unit Test

Integration Test

Acceptance Test

System Test

Page 5: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

WHAT

Continuous Integration

5

... is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly.

Martin Fowler, http://martinfowler.com/articles/continuousIntegration.html

Page 6: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

HOWContinuous Integration

6

unit tests

integration tests

quality assurance

deployment

commit

changes

commit

changes

commit

changes

triggers

build

multi-stage

builds

Page 7: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

HOW

Continuous Integration

7

> Version control repository: CVS, Subversion, Git, Mercurial, etc.

> Build tools: Ant, Maven, Make, Gant, Grails, Rake, etc.

> Continuous integration environment (server): CruiseControl, Continuum, Hudson/Jenkins

Page 8: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

WHY

Continuous Integration

8

> Reduce risks> Defects are detected when they are introduced> Measure the health of a software> Environment always the same and build starts clean => no

assumptions

Source: Paul M. Duval. Continuous Integration. Pearson Education, Inc., 2007

Page 9: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

WHY

Continuous Integration

9

> Reduce repetitive manual processes (safe time and costs)

> Process runs the same every time> Ordered process: compile, unit tests, integration tests, qa, etc.

Source: Paul M. Duval. Continuous Integration. Pearson Education, Inc., 2007

Page 10: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

WHY

Continuous Integration

10

> Generate deployable software at any time and at any place

> Going back in the build history to deploy older, maybe stable, builds

Source: Paul M. Duval. Continuous Integration. Pearson Education, Inc., 2007

Page 11: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

WHY

Continuous Integration

11

> Enable better project visibility> Decisions on quality improvements and tests are shown immediately> Ability to notice trends in various quality metrics (# bugs; # checkstyle,

findbugs, pmd violations; code coverage of test cases)

Source: Paul M. Duval. Continuous Integration. Pearson Education, Inc., 2007

Page 12: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

WHY

Continuous Integration

12

> Establish greater confidence in the software product from the development team

> Making progress is visible and encourages developers> Confidence increases if the increase of overall product quality is visible

Source: Paul M. Duval. Continuous Integration. Pearson Education, Inc., 2007

Page 13: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

WHY

Continuous Integration

13

> Same code basis for every developer: reduces communication overhead

> Go to build #x, do you see...

Source: Paul M. Duval. Continuous Integration. Pearson Education, Inc., 2007

Page 14: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

MEETJENKINS

Continuous Integration

14

Page 15: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

GIT

Version Control

15

> Version control is the management of changes to documents, programs, and other information stored as computer files.

> History of changes to a file visible at any time.

> Maintain a master repository on a server and all developers get a consolidated copy of the project

Page 16: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

GIT

Version Control

16

> Create a repository> $ mkdir project> $ cd project> $ git init

> Create a Java class with an empty method

Page 17: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

GIT

Version Control

17

> Add the file to the repository and commit> $ git add SimpleClass.java> $ git commit

> Make a change to the method

Page 18: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

BUILDAUTOMATION

Maven

> Maven is a build and software project management tool

> Maven works with Project Object Models (pom.xml) files to specify project settings

> Plugin architecture to include tools into the build cycle

18

Page 19: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

MAINPRINCIPLE

Maven

> Convention over configuration> ./src/main/java> ./src/main/resources> ./src/test/java> ./src/test/resources> ./target/classes> ./target/* (*.jar, reports, etc.)

19

Page 20: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

BUILDLIFECYCLE

Maven

> compile> test> package> integration-test> verify> install> deploy> $ mvn <phase>

20

Page 21: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

DEPENDENCYMANAGEMENT

Maven

> Maven works with repositories where a huge number of jars are stored

> Specify a dependency in the POM file> maven downloads the necessary jar file

21

Page 22: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

DEPENDENCYMANAGEMENT

Maven

22

<dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8</version> <scope>test</scope> </dependency></dependencies>

Page 23: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

EXAMPLE

Sports Ground

> Java Enterprise Edition 6 (JEE 6)> RESTful API

> REpresentation State Transfer (JAX-RS)

> JBoss Application Server 7.1> https://github.com/kraftan/ci-showcase

23

Page 24: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

V-Model

24

User needs

System Spec

SubsystemDesign/Spec

UnitDesign/Spec

Unit

Subsystem

System

Delivery

Specification Implementation

Unit Test

Unit test are F.I.R.S.T.FastIsolatedRepeatableSelf-VerifyingTimely (reflect specification)

Page 25: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

V-Model

25

User needs

System Spec

SubsystemDesign/Spec

UnitDesign/Spec

Unit

Subsystem

System

Delivery

Specification Implementation

Unit Test

Integration testsBreak up isolation to componentsUse frameworkNeed run-time environmentAre slower than unit tests

Integration Test

Page 26: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

V-Model

26

User needs

System Spec

SubsystemDesign/Spec

UnitDesign/Spec

Unit

Subsystem

System

Delivery

Specification Implementation

Unit Test

System testsRun against the fully deployed (or installed) applicationSimulate user interaction

Integration Test

System Test

Page 27: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

EFFICIENCYNon-Functional Req

27

> Performance testing> Which component have a long response time?> For instance, certain DB query may take noticeably longer than others

> Load testing> How does the system work under heavy load?> How long does it take to complete a request if specific number of

persons interact with the system

> Stress testing> How does the system react if it is overloaded?

Page 28: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

Used Tools

28

> Git - Version Control> Maven - Build Automation> Jenkins - Continuous Integration> Java EE 6 on JBoss AS 7 (Example on github)> JUnit - Unit testing> mockito - Unit testing in isolation> Arquillian - In-container integration testing> Sonar - Quality Assurance> JMeter - Load testing

Page 29: Continuous Integration - UZH IfI · 2016. 6. 23. · Continuous Integration 12 > Establish greater confidence in the software product from the development team > Making progress

www.comerge.net

Design to TestUse CI to Check

Wrap Up

29