Slide 1

Slide 1 text

SERGEI EGOROV Staff Engineer, Pivotal How Docker Containers Changed the Way We Test Our Software

Slide 2

Slide 2 text

“If I had an hour to solve a problem 
 I'd spend 55 minutes thinking about the problem 
 and 5 minutes thinking about solutions.” — Albert Einstein

Slide 3

Slide 3 text

“If I had an hour to fix a bug 
 I'd spend 55 minutes writing a test 
 and 5 minutes fixing the issue.” — Me

Slide 4

Slide 4 text

Software testing

Slide 5

Slide 5 text

Software testing Integration
 Testing System
 Testing Sanity
 Testing Acceptance
 Testing Regression
 Testing UI
 Testing Unit
 Testing Smoke
 Testing

Slide 6

Slide 6 text

Software testing Integration
 Testing Unit
 Testing System
 Testing Dev Dev

Slide 7

Slide 7 text

• Fast • Simple • Catches bugs in the logic • Checks algorithms Unit testing

Slide 8

Slide 8 text

• Powerful • Challenging • Starts real databases • Catches bugs in integrations • Checks assumptions about other systems Integration testing

Slide 9

Slide 9 text

• Powerful • Challenging • Starts real databases • Catches bugs in integrations • Checks assumptions about other systems Integration testing

Slide 10

Slide 10 text

Cross-platform Isolated Reproducible CI friendly Fast 2 1 3 4 5 Integration testing challenges

Slide 11

Slide 11 text

Integration testing transformation Mocking

Slide 12

Slide 12 text

Integration testing transformation Mocking • DB logic is not tested • Assumptions, not facts

Slide 13

Slide 13 text

Integration testing transformation Mocking Local DBs

Slide 14

Slide 14 text

Integration testing transformation Mocking Local DBs • Not cross-platform • Complex installation process • Hard to isolate

Slide 15

Slide 15 text

Integration testing transformation Mocking Local DBs VMs

Slide 16

Slide 16 text

Integration testing transformation Mocking Local DBs VMs • Vagrant to the rescue • Slow • Port management is hard • Heavyweight images

Slide 17

Slide 17 text

Integration testing transformation Mocking Local DBs VMs Docker

Slide 18

Slide 18 text

Image Me

Slide 19

Slide 19 text

Simple

Slide 20

Slide 20 text

Integration testing transformation Mocking Local DBs VMs Docker Fig
 (aka Docker Compose)

Slide 21

Slide 21 text

Declarative

Slide 22

Slide 22 text

Declarative R U UP?

Slide 23

Slide 23 text

Declarative Random ports?

Slide 24

Slide 24 text

Declarative DB per test?

Slide 25

Slide 25 text

IDE integration?

Slide 26

Slide 26 text

Integration testing transformation Mocking Local DBs VMs Docker Fig
 (aka Docker Compose) Docker API

Slide 27

Slide 27 text

WHAT IF I TOLD YOU THERE IS AN API

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

Testcontainers •http://testcontainers.org •Library instead of a tool −Throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container. −Takes care of not just starting, but also running & destroying your test’s dependencies. −Very robust environment discovery (Linux, Windows, Mac OS X, CI environments, Docker in Docker, etc) •OSS project −Originally created by Richard North −MIT licensed −A vibrant community of the testing-oriented people. •JVM first −Initially implemented as a Java library −Community-contributed ports: C#, Golang, NodeJS, Python, Rust −Plans to share the implementation between the languages

Slide 30

Slide 30 text

“Code your containers”

Slide 31

Slide 31 text

Fast feedback

Slide 32

Slide 32 text

Fast feedback Different strategies

Slide 33

Slide 33 text

Fast feedback Host detection

Slide 34

Slide 34 text

Fast feedback Pre-flight environment checks

Slide 35

Slide 35 text

CI friendly

Slide 36

Slide 36 text

CI friendly

Slide 37

Slide 37 text

CI friendly

Slide 38

Slide 38 text

Who is using

Slide 39

Slide 39 text

Thank you! @bsideup