2. Testing Microservices
A microservices architecture consists of focused, small services that together
create a complete application or task. Every instance of a microservice
represents a single responsibility within your application. The real advantage is
that, these services are independent of one another, which makes them
independently deployable and testable.
3. Types of Testing
1. Unit Testing
2. Contract Testing
3. Integration Testing
4. End-To-End Testing
5. UI/Functional Testing
4. Unit Testing
The scope of unit testing is internal to the service. In terms of volume of tests,
they are the largest in number. Unit tests should ideally be automated,
depending on the development language and the framework within the service.
Examples : JUnit Test, Hamcrest, Mockito
5. Contract Testing
Contract testing is a methodology for ensuring two separate systems are
compatible and are able to communicate with one another. It captures the
interaction that are exchanged between each service, storing them in a
contract, which can then be used to verify that both parties adhere to it.
Contract testing goes beyond schema testing, requires both parties to come to
a consensus on the allowed set of interactions and allowing for evolution over
time.
7. Contract Testing
You can use open source contract testing tool for testing HTTP requests,
responses and message integrations by using contract test.
Example : Pack
8. Integration testing
Verification of the services that have been individually tested much be
performed. This critical part of microservice architecture testing relies on the
proper functioning of inter-service communications. Service call must be made
with integration to external services, including error and success cases.
Integration testing thus validates that the system is working together
seamlessly and that the dependencies between the services are present as
expected.
9. Integration testing
Tools for performing integration testing examples :
free application
written in the Go
language.
highly effective and used performance test
tools for testers
microservices test tool written in
Scala, which allows it to perform
simulations on many platforms. At
the end of emulation, Gatling reports
on metrics like active user numbers &
response times automatically.
10. Integration testing
Tools for performing integration testing examples :
an end-to-end, open-source distributed tracing tool
that checks and troubleshoots microservices-centric
systems. With tracking services across the software's
operations environ, it can carry out root-cause
scrutiny, examine key service dependencies and
discover areas for optimizing performance.
an automated, open-source API communication simulation
tool that assists with integration tests. The user can test how
APIs react to precise events, like rate limits and latency in
the network. It also runs test calls between microservices by
emulating communications and then records responses and
requests in proxy mode to confirm they work as expected.
11. Integration testing
Tools for performing integration testing examples :
contract test tool that monitors
HTTP and message interactions
to make sure apps are
functioning in a consumer-driven
contract manner.
a monitoring solution that monitors
resource use for apps or
microservices deployed on Amazon
Web Services. Thus, it can be a
helpful tool if you wish to execute
load tests for microservices.
Grafana is a free metric visualization
& analytics suite. One can use it to
visualize time series data to notice
how your microservices react under
real-time traffic.
12. End To End Testing
End-to-End testing verifies that the entire process flows work correctly,
including all service and DB integration. Thorough testing operations that affect
multiple services ensures that the system works together as a whole and
satisfies all requirements. Frameworks like JBehave help automate. Functional
testing by taking user stories and verifying that the system behaves as
expected.
13. End To End Testing
testRigor Avo Assure BugBug Mabl Selenium
WebDriver
Testcafe
Nightwatch Autify Endtest
14. UI/Functional Testing
User interface testing is the testing of the highest order as it tests the system
as an end-user would use it. Testing of this level must feel like a user trying to
interact with the system. All the databases, interfaces, internal and third-party
services must work together seamlessly to produce the expected results.