35
Szczepan Faber I’m obsessed with quality I coached teams I preached at conferences I’m test driven Every test is neat and fast Coverage is 90%+ and I release every 2 yearsWTF?

JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

  • Upload
    proidea

  • View
    65

  • Download
    0

Embed Size (px)

DESCRIPTION

Mockito is intended to help writing cleaner and easier to maintain tests. Many tools and frameworks have similiar goals. Also, there are practices and methodologies focused around writing test code, TDD being the best example. We have the tooling, we have the methodology, we can start writing high quality test code any day (or continue doing it). The next logical step is to fully capitalize comprehensive and stable automated test coverage, and start delivering continuously. We will discuss it based on your experience and my lessons learned from Mockito, Gradle, and corporate environments I worked in from Europe to Silicon Valley.

Citation preview

Page 1: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Szczepan Faber I’m obsessed with quality I coached teams I preached at conferences I’m test driven Every test is neat and fast Coverage is 90%+ and I release every 2 years… WTF?

Page 2: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber
Page 3: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Evolution Continuous Delivery is a black belt in Continuous Integration C.D. is like C.I. evolved

Page 4: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Mindset not a tool C.I: keeps software ready for development and validation gives quick feedback about the correctness

C.D: keeps software ready for the release gives quick feedback about the business value

Page 5: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Principles

Every build is a release candidate Automate Have quality automated tests More info: read the book :) see Jez Humble’s videos on the web

Page 6: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber
Page 7: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Menu

How Mockito does it How Gradle does it How big and famous do it

Page 8: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

2007/2008

beautiful tests

less brittleness

easy to write

Page 9: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

test code is code proud of the code

Page 10: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Recipe

+

Page 11: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Mockito popularity 9th java library or maybe 4th?

Page 12: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Problem I’m obsessed with quality I coached teams I preached at conferences I’m test driven Every test is neat and fast Coverage is 90%+ and I release every 2 years… WTF?

Page 13: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Deliver!

Quality is irrelevant What matters is “quality delivered”

Page 14: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Mockito 1.9.*

time consuming release notes creation rare releases release fear demotivating growing backlog concerned community

Page 15: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Mockito 1.10.*

●  time consuming release notes creation ●  rare releases ●  release fear ●  demotivating growing backlog ●  concerned community Challenges: ●  automation ●  quality assurance

Page 16: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Mockito’s model

push == new version (not snapshot) release notes and docs release notes automated can release from a phone ~10 minutes new energy

Page 17: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Tools

Page 18: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Integration

Page 19: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Travis CI and GitHub (via Gradle)

Travis CI can read and write to GitHub OAuth2 protocol Travis CI environment variables encryption GitHub REST API

Page 20: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Travis CI and Bintray

Bintray and jcenter Gradle Bintray plugin Bintray REST API

Page 21: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

http://blog.bintray.com

Page 22: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Continuous Delivery

Releasing is fun instead of a chore Working on a feature or a bug is exciting Releasing is part of regular routine “Make releasing boring. No more adrenaline.” ~Jezz Humble

Page 23: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Mockito’s continuous delivery model wound’t be possible without...

Page 24: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Gradle’s release model

Release every ~2 months Major version release every 1-2 years Nightly builds Lots of automated validation Very credible tests

Page 25: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber
Page 26: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Challenges

Fast full feedback cycle from automated checks Huge amounts of automated tests Cross-platform testing Automated performance tests Flaky tests Culprit detection

Page 27: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Patterns

Page 28: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Flaky tests

What can we do about flaky tests? Flaky tests are a part the world Understand them. Model them. Automate them. Eliminate the the expensive flaky tests regularly.

Page 29: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Test selection

Do I need to invoke all available tests to validate my change?

Page 30: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Dry-running a change

How can I ensure that my change does not break the build?

Page 31: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Culprit detection

How to track down a test failure to a commit?

Page 32: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

What is the “last known good” version?

Good version

Page 33: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Enterprise dependencies

Does my change breaks components that depend on me?

Page 34: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Perceptual diffs

“The Secret to Safe Continuous Deployment” ~Google developers

Page 35: JDD2014: Continuous delivery: capitalizing high quality automated tests - Szczepan Faber

Thanks! Continous Delivery is a mindset Start slowly and incrementally Automate more Code is worth zero until released

Szczepan Faber Engineer, coach, consultant

@szczepiq