Testing in the 21st Century

54
Testing in the 21st Century As Unicorns Alex Soto Red Hat Engineer @alexsotob

Transcript of Testing in the 21st Century

Page 1: Testing in the 21st Century

Testing in the 21st CenturyAs Unicorns

Alex SotoRed Hat Engineer@alexsotob

Page 2: Testing in the 21st Century

@alexsotob2

Alex Soto

Red Hat Engineer

www.lordofthejars.com

@alexsotob

Who Am I?

Page 3: Testing in the 21st Century

@alexsotob3

https://www.manning.com/books/testing-java-microservices

Page 4: Testing in the 21st Century

S O F T WA R E I S E AT I N G T H E W O R L D

Page 5: Testing in the 21st Century

@alexsotob5

Page 6: Testing in the 21st Century

@alexsotob6

Page 7: Testing in the 21st Century

@alexsotob7

Page 8: Testing in the 21st Century

“With great power, there must also come—great responsibility.”

—SPIDERMAN (STAN LEE)

Page 9: Testing in the 21st Century

@alexsotob9

Page 10: Testing in the 21st Century

@alexsotob10

Page 11: Testing in the 21st Century

@alexsotob11

Page 12: Testing in the 21st Century

@alexsotob12

Testing

Page 13: Testing in the 21st Century

@alexsotob13

Testing Evolution to micro services world

Manual Tests

After Code Automatic

Test

Test First TDD and BDD

Service Virtualization

and CDC

Testing in Production

Page 14: Testing in the 21st Century

@alexsotob14

Micro Services architecture

Page 15: Testing in the 21st Century

@alexsotob15

Service Virtualization

Page 16: Testing in the 21st Century

@alexsotob16

@Mock EmailService email;

Mockito.when(email.receiveBodyMessagesWithSubject("My Subject”)) .thenReturn("This is My Message")

// Test calls

Mockito.verify(email, Mockito.times(1)) .receiveBodyMessagesWithSubject(Matchers.anyString());

@ClassRule public static HoverflyRule hoverflyRule = HoverflyRule.inSimulationMode(SimulationSource.dsl( service("api.flight.com") .get("/api/bookings/1") .willReturn(success("{\"bookingId\":\"1\"\}", "application/json")) ));

// Test calls

hoverfly.verify( service(matches("*.flight.*")) .get("/api/bookings") .anyQueryParams());

Record Method Expectation

Verify Method Called

Record Service Expectation

Verify Service Called

Page 17: Testing in the 21st Century

@alexsotob17

Contract Tests

Page 18: Testing in the 21st Century

@alexsotob18

Consumer

request

response Stub Server

expectations

Provider

request

response

Result

Define Consumer Expectations Verify Expectations On Provider

Page 19: Testing in the 21st Century

@alexsotob19

We are on Production

Page 20: Testing in the 21st Century

@alexsotob20

Shit! We break Production Environment

Page 21: Testing in the 21st Century

@alexsotob21

Blue-Green Deployments

Page 22: Testing in the 21st Century

Starts with a “git commit and git push”

Blue/Green Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

BUILDSCM

Page 23: Testing in the 21st Century

Blue/Green Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

BUILDSCM

Page 24: Testing in the 21st Century

Blue/Green Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

BUILDSCM

Page 25: Testing in the 21st Century

Blue/Green Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

BUILDSCM

Page 26: Testing in the 21st Century

Blue/Green Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

BUILDSCM

Page 27: Testing in the 21st Century

Blue/Green Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 28: Testing in the 21st Century

Blue/Green Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 29: Testing in the 21st Century

@alexsotob29

Canary Release

Page 30: Testing in the 21st Century

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 31: Testing in the 21st Century

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 32: Testing in the 21st Century

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 33: Testing in the 21st Century

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 34: Testing in the 21st Century

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 35: Testing in the 21st Century

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 36: Testing in the 21st Century

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 37: Testing in the 21st Century

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 38: Testing in the 21st Century

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 39: Testing in the 21st Century

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 40: Testing in the 21st Century

@alexsotob @AndyGeeDe40

Dark Launches

Page 41: Testing in the 21st Century

Dark Launches

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

INTERNAL USERS

Page 42: Testing in the 21st Century

Dark Launches

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 43: Testing in the 21st Century

@alexsotob43

Page 44: Testing in the 21st Century

@alexsotob44

Page 45: Testing in the 21st Century

@alexsotob45

Business Logic

Centralized Configuration

Distributed Tracing

Service Discovery

Load Balancing

Circuit Breaking

Page 46: Testing in the 21st Century

@alexsotob46

NETFLIX Ribbon

Config Server

Java Microservices Platform circa 2016

Page 47: Testing in the 21st Century

@alexsotob47

Istio

Java Microservices Platform circa 2018

Page 48: Testing in the 21st Century

@alexsotob48

DEMO

Video of Demo at https://youtu.be/jYXX6Mfai2A

Page 49: Testing in the 21st Century

@alexsotob49

Let’s Wind Down

Page 50: Testing in the 21st Century

@alexsotob50

Tests are a Team

Page 51: Testing in the 21st Century

@alexsotob51

Secure Your Steps

Page 52: Testing in the 21st Century

@alexsotob52

Automate Everything

Page 53: Testing in the 21st Century

“Change is the essential process of all of existence.”

—SPOCK

Page 54: Testing in the 21st Century

@alexsotob

[email protected]

https://developers.redhat.com/