Skip to content

Latest commit

 

History

History
65 lines (53 loc) · 3.96 KB

README.md

File metadata and controls

65 lines (53 loc) · 3.96 KB

test-pyramid

Simple project to apply Test Pyramid methodology together with Clean Architecture Test Pyramid There are some code samples showing how to test on each layer of the pyramid, from bottom to top, and how each layer exercises a real component or use an emulated one:


5th layer - Unit Tests

Test Pyramid The Business Class (or Utility Class) to be tested has all its internal objects emulated with a Mock instance (expected input and output defined on Test Class), and widely tested to cover all input variations and expected results. Examples:


4th layer - Integration

Integration The Business Class to be tested has all its Integration Resorces (Data Provider, or even a External Resource Client) executed with the real instances, and the final resource emulated with an on-memory database (like H2) initialized right before the Test, and discarded at end, or emulated with a WireMock instance with expected requests and payloads. In this layer the tests have less scenarios, only covering the external resource's variations. Examples:


3rd layer - Component

Component The role application is tested calling all it's entrypoints, but still emulating external resources (like example above). In this layer the tests have fewer scenarios, only covering the entrypoints input and output variations. Examples:


2nd layer - End-to-End

Test Pyramid The role application is tested in a dedicated environment, where all external resources are real, most similar to production environment as it's possible. In this layer the tests are still made with an automated tool, but only cover the scenarios where the data has a state.


1st layer - Exploratory

Test Pyramid The role application is tested in a dedicated environment, where all external resources are real, most similar to production environment as it's possible. In this layer the tests are usualy made by a human, on pre-defined scenarios based on final user experience.


References