2. AGENDA
2
What is Microservice Architecture ?
What each Service made of ?
Ensuring Test Coverage and Getting Faster feedback
Discuss some real time scenarios and my learnings
Q & A
4. KEY TAKEAWAYS
4
Modelled around the business domain
Small and Focused
Loosely Coupled
Language Neutral
De-centralized governance and data management
Microservices are :
5. A SERVICE IS MADE OF
5
Resource
Service Layer/
Domain
Repository
Data Mapper
Gateway
External
Datastore
Services
7. TESTING THE UNIT
7
Resource
Service Layer/
Domain
Repository
Data Mapper
Gateway
- unit
UNIT TESTING is to test
behaviour of a single testable
unit.
8. TESTING THE COMMUNICATION PATH
8
Resource
Service Layer/
Domain
Repository
Data Mapper
Gateway
- Integration Path
Datastore
Event Streaming
<Asynchronous
Call>
Integration Testing is
to test communication
path and collaboration
between different
modules usually
data store and External
components.
9. INTEGRATION PROBLEM
Service A Service B
Service
B
Test 1
Test 2
Test 3
Application Boundary
Slow and less
reliable approach
10. CONSUMER DRIVEN CONTRACT TEST
USING PACT
Service A Service B
ProviderConsumer
PACT
<HTTP request>
<Expected HTTP Response>
(Mock HTTP Server)
<Replay Request>
<Assert HTTP Response>
Application Boundary
Record
Replay
Replay
{accountNumber : 100}
{
firstName : A,
surName : B
}
11. TEST END-TO-END BEHAVIOUR
Application Boundary
Service
A
Service
C
Service
B
Event Streaming
<Asynchronous
Call>
<Synchronous Call>
API
Gateway
Test
End to End TESTING is to test application as a whole in a way actual
user will be using it.
MICROSERVICES
ARCHITECTURE
OR
LEGACY SYSTEM
12. END-TO-END TEST SHOULD BE
12
Low in number as possible
Test it the way, User will be using it i.e. User Journey
Include test in Build pipeline to get faster feedback
Data-independent Test
14. MY LEARNINGS FROM REAL TIME SCENARIOS
14
Ensure status codes are returned correctly
Ensure you always test through flaky endpoints i.e.API Gateway / Externally
Exposed endpoint
Test whether Application still work if one of the instance of
service/Database/Event Streaming is down
Test whether logs generated are meaningful and simple to understand
to retrospect
, as Its all about asking the right questionBEING AGILE HELPED ME
Build verification Test gives you lot of confidence