Testing Patterns Flashcards
Testing patterns
Service Component Test
Consumer-driven contract test
Consumer-side contract test
Service Component Test: context
You have applied the Microservice architecture pattern. The application consists of numerous services. Services often invoke other services. You must write automated tests that verify that a service behaves correctly.
Service Component Test: problem
How do you easily test a service?
Service Component Test: forces
End to end testing (i.e. tests that launch multiple services) is difficult, slow, brittle, and expensive.
Service Component Test: solution
A test suite that tests a service in isolation using test doubles for any services that it invokes.
Service Component Test: example
Spring Cloud Contract is an open source project that supports this style of testing.
Service Component Test: result benefits
Testing a service in isolation is easier, faster, more reliable and cheap
Service Component Test: result drawbacks
Tests might pass but the application will fail in production
Service Component Test: issues
How to ensure that the test doubles always correctly emulate the behavior of the invoked services?
Service Component Test: related
Service Integration Contract Test
Service Integration Contract Test: context
You have applied the Microservice architecture pattern. The application consists of numerous services. Services often invoke other services. You must write automated tests that verify that a service behaves correctly.
Service Integration Contract Test: problem
How to easily test that a service provides an API that its clients expect?
Service Integration Contract Test: forces
End to end testing (i.e. tests that launch multiple services) is difficult, slow, brittle, and expensive.
Service Integration Contract Test: solution
A test suite for a service that is written by the developers of another service that consumes it. The test suite verifies that the service meets the consuming service’s expectations.
Service Integration Contract Test: example
Spring Cloud Contract is an open source project that supports this style of testing.