Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó,...

29
Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH

Transcript of Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó,...

Page 1: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Testen von Microservices

Erfahrungsbericht und Umfrage

David Faragó, EclipseSource & QPR

Dehla Sokenou, GEBIT Solutions GmbH

Page 2: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Microservices

Architekturprinzip für Software

Kleine, unabhängig Einheiten, die Daten und Services kapseln

● Klare Entkopplung

● Auch keine indirekte Kopplung, bspw. über gemeinsam verwendete

Datenbankobjekte

● Ein Microservice = eine (möglichst kleine) Aufgabe

Kommunikation ausschließlich über sprachunabhängige Schnittstellen

Do one thing and do it well.

Page 3: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Klassische Systeme vs. Microservices

Quelle: Kristijan Arsov. What Are Microservices, Actually? https://dzone.com/articles/what-are-microservices-actually

Page 4: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Microservices – Umfeld

DevOps

Container

Cloud

Page 5: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Microservices – Eine kurze Bilanz

Vorteile

● Klare Verantwortlichkeiten für Schnittstellen und Daten

● Unabhängige Releasezyklen und Deployment

● Unabhängige Teams

Herausforderungen

● Integration der vielen verschiedenen Microservices

● Einheitlichkeit, z.B. in Bezug auf die Benutzerschnittstelle

● Testen?

Page 6: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Microservices Pro & Contra aus Testersicht

Aspekt Pro Contra

Team Jeder MS kann von anderen

Teams getestet werden

Verantwortlichkeit für das

Gesamtsystem?

Software Kleinere unabhängige

Einheiten

Verknüpfung der MS

zusätzliche Komplexität

Verteilung Neben Fehlervermeidung

auch Recovery (MTBF & MTTR)

Schwieriges Testumfeld

durch ständige Änderung

Umgebung Replikation der Umgebung

für Testzwecke

Umgebung komplex

Page 7: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Aspekt Pro Contra

Team Jeder MS kann von anderen

Teams getestet werden

Verantwortlichkeit für das

Gesamtsystem?

Software Kleinere unabhängige

Einheiten

Verknüpfung der MS

zusätzliche Komplexität

Verteilung Schwieriges Testumfeld

durch ständige Änderung

Umgebung Replikation der Umgebung

für Testzwecke

Umgebung komplex

Microservices Pro & Contra aus Testersicht

Umfrage:

Kommen Sie in Berührung mit der

Entwicklung von Microservices?

Page 8: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Software-Fehlerklassifizierung

Die weitaus meisten Fehler sind nicht funktionaler Art!

Page 9: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Software-Fehlerklassifizierung

Umfrage:

In welche Klassen

fallen Ihre Fehler?

Page 10: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Teststufen gestern

Test-Pyramide

Page 11: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Teststufen heute

Test-Hut

Page 12: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Teststufen morgen

Erweiterte Test-

Pyramide

Page 13: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Teststufen und Werkzeuge

xUnit

AssertJ

Mocking-Frameworks

Hoverfly Arquillian

testcontainers.org

PACT

REST-assured

Moco

Pretender

mountebank

Cukes in Space!

Selenium

Arquillian Cube Observatiliby-Tools

Serenity BDD

Po

stm

an

Cucumber

Page 14: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Teststufen und Werkzeuge

Umfrage:

Wieviel Prozent testen Sie

auf jeder Teststufe?

Page 15: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Twelve-Factor-App

# Factor Description

I Codebase There should be exactly one codebase for a deployed service with the codebase being used for many deployments.

II Dependencies All dependencies should be declared, with no implicit reliance on system tools or libraries.

III Config Configuration that varies between deployments should be stored in the environment.

IV Backing services All backing services are treated as attached resources and attached and detached by the execution environment.

V Build, release, run The delivery pipeline should strictly consist of build, release, run.

VI Processes Applications should be deployed as one or more stateless processes with persisted data stored on a backing service.

VII Port binding Self-contained services should make themselves available to other services by specified ports.

VIII Concurrency Concurrency is advocated by scaling individual processes.

IX Disposability Fast startup and shutdown are advocated for a more robust and resilient system.

X Dev/Prod parity All environments should be as similar as possible.

XI Logs Applications should produce logs as event streams and leave the execution environment to aggregate.

XII Admin Processes Any needed admin tasks should be kept in source control and packaged with the application.

Page 16: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Twelve-Factor-App

# Factor Description

I Codebase There should be exactly one codebase for a deployed service with the codebase being used for many deployments.

II Dependencies All dependencies should be declared, with no implicit reliance on system tools or libraries.

III Config Configuration that varies between deployments should be stored in the environment.

IV Backing services All backing services are treated as attached resources and attached and detached by the execution environment.

V Build, release, run The delivery pipeline should strictly consist of build, release, run.

VI Processes Applications should be deployed as one or more stateless processes with persisted data stored on a backing service.

VII Port binding Self-contained services should make themselves available to other services by specified ports.

VIII Concurrency Concurrency is advocated by scaling individual processes.

IX Disposability Fast startup and shutdown are advocated for a more robust and resilient system.

X Dev/Prod parity All environments should be as similar as possible.

XI Logs Applications should produce logs as event streams and leave the execution environment to aggregate.

XII Admin Processes Any needed admin tasks should be kept in source control and packaged with the application.

Umfrage:

Wie wichtig ist für Sie

Dev/Prod-Parity?

Page 17: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Teststufen morgen (2)

so niedrig wie möglich (Shift Left)

Test-Rechteck

Page 18: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip
Page 19: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Staging

Green/Blue bzw. Red/Black-Deployment

Quelle: Jason Skowronski. Intro to deployment strategies: blue-green, canary, and more.

https://dev.to/mostlyjason/intro-to-deployment-strategies-blue-green-canary-and-more-3a3

Page 20: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Staging

Green/Blue bzw. Red/Black-Deployment

Quelle: Jason Skowronski. Intro to deployment strategies: blue-green, canary, and more.

https://dev.to/mostlyjason/intro-to-deployment-strategies-blue-green-canary-and-more-3a3

Page 21: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Staging

Canary-Deployment

Quelle: Jason Skowronski. Intro to deployment strategies: blue-green, canary, and more.

https://dev.to/mostlyjason/intro-to-deployment-strategies-blue-green-canary-and-more-3a3

Page 22: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Staging

Canary-Deployment

Quelle: Jason Skowronski. Intro to deployment strategies: blue-green, canary, and more.

https://dev.to/mostlyjason/intro-to-deployment-strategies-blue-green-canary-and-more-3a3

Page 23: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Testtreiber

Page 24: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Testtreiber

FAULT INJECTION

Page 25: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

CHAOS MONKEY TESTING

Testtreiber

FAULT INJECTION

Page 26: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Observability / Fehleranalyse

ELK-Stack

Leichtgewichtige Alternative: Graylog & Grafana

LOG

Process Store Visualize

Page 27: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Observability / Fehleranalyse

ELK-Stack

Leichtgewichtige Alternative: Graylog & Grafana

LOG

Process Store Visualize

Umfrage:

Verwenden Sie

Observability/Monitoring?

Page 28: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Fazit

Dev/Prod-Parity

Shift left

(niedrigere Teststufe)

möglich?

Page 29: Testen von Microservices · Testen von Microservices Erfahrungsbericht und Umfrage David Faragó, EclipseSource & QPR Dehla Sokenou, GEBIT Solutions GmbH . Microservices Architekturprinzip

Diskussion und Fragen

Umfrage:

Wieviel Prozent testen Sie

auf jeder Teststufe?

Umfrage:

In welche Klassen

fallen Ihre Fehler? Umfrage:

Kommen Sie in Berührung mit der

Entwicklung von Microservices?

Umfrage:

Wie wichtig ist für Sie

Dev/Prod-Parity? Umfrage:

Verwenden Sie

Observability/Monitoring?