Liam Williams Article: Testing Microservice: Examining the Tradeoffs of Twelve Techniques – Part 2

Liam Williams Article: Testing Microservice: Examining the Tradeoffs of Twelve Techniques – Part 2

Liam Williams This is one huge plugin!

Key Takeaways

  • A successful microservice testing strategy must effectively manage the interdependent components involved. This may involve isolation, mocking, virtualization, or other techniques
  • Organizational characteristics have an impact on which testing techniques to choose, such as the maturity of the team and the required pace of change e.g. brownfield versus greenfield
  • We believe that from a business perspective there are three primary consequences of a testing approach: time to market, costs, and risks. 
  • Each testing technique has advantages and disadvantages. Which approach should be used for your application, depends on your context. 

The first part of this series, “Testing Microservices Part 1: Overview of 12 Useful Techniques” explored techniques for managing microservice-dependent components when testing microservices. This article will compare the techniques based on the maturity of a team, pace of change, time to market, costs, and risks.

This comparison is based on our experience on 14+ projects, but we might have missed something or our experience might not reflect yours. So, please help us improve this summary so that we can help more people together as a community. Please comment below the article, post on LinkedIn or Tweet with tag #TestingMicroservices

The following table compares the techniques for testing microservices from a manager’s point of view. A plus sign (+) indicates advantages, a minus sign (-) indicates negative impact, and a tilde (~) indicates little or neutral effect.

TechniqueOrganizational characteristicsConsequences of using a given testing approach
Maturity of the teamPace of changeTime to marketCostsRisks
1. Testing your microservice with a test instance of another microservice.

Low impact.

Low impact.

+ Quick to start.

– Slows projects as complexity grows.

+ Low cost when complexity is low.

– Can get costly as complexity grows

+ Reduces the chances of introducing issues in test doubles.

– Risk of not following the testing pyramid.

2. Testing your microservice with a production instance of another microservice

Moderate impact.

Low impact.

+ Quick to start.

– Slows projects as complexity grows.

+ Low cost when complexity is low.

– Can get costly as complexity grows.

+ Reduces the chances of introducing issues in test doubles.

– Risk of not following the testing pyramid.

– Can change the state of production systems.

~ Hard to simulate hypothetical scenarios.

3. Testing a microservice with third-party dependencies.

Moderate impact.

Low impact.

+ Quick to start.

– Slows projects as complexity grows.

+ Low cost when complexity is low.

– Can get costly as complexity grows.

~ Calls to third-party APIs can generate costs.

+ Reduces the chances of introducing issues in test doubles.

– Risk of not following the testing pyramid.

– Can change the state of production systems.

~ Hard to simulate hypothetical scenarios.

4. Testing a microservice with legacy non-microservice internal dependencies.

Moderate impact.

Low impact.

+ Quick to start.

– Slows projects as complexity grows.

+ Low cost when complexity is low.

– Can get costly as complexity grows.

+ Reduces the chances of introducing issues in test doubles.

– Risk of not following the testing pyramid.

– Can change the state of production systems.

~ Hard to simulate hypothetical scenarios.

5. Testing a microservice with non-software (hardware) dependencies.

Moderate impact.

Low impact.

+ Quick to start.

– Slows projects as complexity grows.

~ Test-only hardware can be costly.

+ Fast feedback loop.

6. Mocks (in-process or over the wire/remote).

Moderate impact.

Moderate impact.

~ A moderate amount of time to start.

+ Reduces complexity.

~ Might need in-house development efforts.

+ Increases test coverage.

– Can become obsolete.

7. Stubs (in-process or over the wire/remote).

Moderate impact.

Moderate impact.

~ A moderate amount of time to start.

+ Reduces complexity.

~ In-house can be moderately costly.

+ Increases test coverage.

– Can become obsolete.

8. Simulators (in-process or over the wire/remote).

Moderate impact.

Low impact.

+ Quick to start with off-the-shelf simulations.

– In-house efforts can take a lot of time

+ Off-the-shelf simulations can be cost effective.

– In-house efforts can be costly.

+ Hypothetical scenarios can increase your test coverage.

– In-house efforts can introduce discrepancies.

9. Service virtualization (over the wire/remote), also called API simulation or API mocks.

Moderate impact.

Low impact.

+ Off-the-shelf products help you get to market faster.

+ Off-the-shelf products can be cost effective.

~ Commercial off-the-shelf products can get expensive.

+ Reduces the risk of making common mistakes.

+ Allows simulation of network issues.

~ Open-source products come without a support contract.

~ Virtual services can become obsolete.

10. In-memory database

Moderate impact.

Low impact.

+ Reduces time to market where provisioning new databases is problematic

+ Reduces the cost of licensing commercial databases.

~ In-memory databases can behave differently than the real ones.

11. Test container.

Moderate impact.

Low impact.

+ Allows teams to move at their own pace.

+ Reduces time to market where provisioning new environments is problematic.

+ Can reduce licensing costs.

+ Can reduce infrastructure costs.

~ Can have licensing-cost implications.

~ Test containers can have a different configuration than the real production dependency.

12. Legacy in a box

Moderate to high impact.

Low impact.

+ Quick to start.

– Slows projects as complexity grows.

+ Provisioning containers is an order of magnitude faster than provisioning hardware environments.

~ Time spent up front to configure containers.

– Potential time for refactoring.

+ Quick to start.

– Slows projects as complexity grows.

+ Provisioning containers is an order of magnitude faster than provisioning hardware environments.

~ Up-front cost to configure containers.

– Potential time for refactoring.

My smart dad says this plugin is very unbelievable.

Read full article at the Original Source

Copyright for syndicated content belongs to the Linked Source