verifying microservices in chains without chain testing? · • spotify: testing of microservices...

19
Verifying microservices in chains without chain testing? Pascal Dufour [email protected] @pascal_dufour

Upload: others

Post on 28-May-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

Verifying microservices in chains without chain

testing?

Pascal Dufour

[email protected]

@pascal_dufour

Page 2: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

Pascal Dufour

AgiliX @ TestCon Europe 2019

Getting a Grip on Exploratory Testing

Page 3: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

Consumer Driven Contracts

What do you know.

1 minute

AgiliX @ TestCon Europe 2019

Page 4: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

A) Statement 1: Discuss 2 minute with your neighbor

B) Statement 1: Discus 3 minute with a pair of neighbors

C) Vote as a group

Debrief &Take aways

The plan for this “talk”

AgiliX @ TestCon Europe 2019

Basics

Repeat with statement 2

Repeat with statement 3

Repeat with statement 4

Page 5: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

AgiliX @ TestCon Europe 2019

Page 6: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

The Idea?

Producer

Consumer

x

Consumer

y

Consumer

z

A

B

C

A’

D

B’

E

Scenario’s

Contracts :

AgiliX @ TestCon Europe 2019

Page 7: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

Definitions

• Consumer Driven Contracts is a pattern that drives the development of the Producer from its Consumers point of view.

• ProducerService that exposes an API / Sends an message

• Consumer Service that consumes the the API of the producer /Send a request

• ContractAgreement between consumer and producer what the API / message will look like.

AgiliX @ TestCon Europe 2019

Page 8: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

Which problems solves CDC

• Late feedback from a changing API.

• Producer design not fitting the expectation by consumers

• Unclear expectation of the behavior of the API

AgiliX @ TestCon Europe 2019

Page 9: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

AgiliX @ TestCon Europe 2019

Chain testing reality

• The real thing

• Visual tests

• Business test

• Realistic simulations

• Connected to all external systems

• ”All” user test are possible

Positive

• Test data (hell)• Never in sync (configuration)• Long run time• Difficult to debug• Late feedback• Too many dependencies• Operation costs• False sense of security

Negative

Page 10: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

Microservices

Is there for microservices a different test strategy?

AgiliX @ TestCon Europe 2019

e 2 e

Integration

Unit

Page 11: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

AgiliX @ TestCon Europe 2019

Page 12: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

CDC is only useful for testing the syntaxmax fieldlength, only

nummeric, optional/mandatory

AgiliX @ TestCon Europe 2019

Page 13: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

Relations between dependent fields should

be tested!When Tax amount is specified,

Tax % might be required

AgiliX @ TestCon Europe 2019

Page 14: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

A CDC-test should always break when a contract is changed!

AgiliX @ TestCon Europe 2019

Page 15: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

Every response status has a corresponding test!

A 404 (object not found)

AgiliX @ TestCon Europe 2019

Page 16: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

Debrief

• Consumer Driven Contracts is a pattern that drives the development of the Producer from its Consumers point of view.

• Force communication

• Formal

• Documentation

• Fast feedback during development

AgiliX @ TestCon Europe 2019

Page 17: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

Take aways

• Consumer Driven Contracts is a pattern that drives the development of the Producer from its Consumers point of view.

• Force communication • Fast feedback to the developer. • Producer design seen as black box (design should be tested by

producer it self)• Data format like an IBAN number should be tested.• Contract should be extendable (adding additional fields by the

producer should be possible.)• Stubs needed for the contract are useful elsewhere• The principle of CDC can be used outside micro services.

AgiliX @ TestCon Europe 2019

Page 18: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

Thank you

All slides can be download at http://Agilix.nl/

AgiliX @ TestCon Europe 2019

Page 19: Verifying microservices in chains without chain testing? · • Spotify: Testing of Microservices Special thanks to AgiliX @ TestCon Europe 2019. Title: Verifying microservices in

Links

• Martin Fowler Consumer-Driven Contracts: A Service Evolution Pattern

• Marcin Grzejszczak consumer driven contract

• Spotify: Testing of Microservices

Special thanks to

AgiliX @ TestCon Europe 2019