Inc. or its affiliates. Unit tests: Patterns Arrange-Act-Assert or Given-When-Then Assert code path variations Test validations and features within a Construct Test helpers 7
Inc. or its affiliates. Unit tests: Patterns (cont.) Fine-grained assertions Assert code path variations Tests as documentation Good for testing individual Constructs 8 Not a good approach to test entire Stacks. Use Template Snapshots instead.
Inc. or its affiliates. Unit tests: Patterns (cont.) Template snapshots Compares the synthesized template against a stored snapshot Great to guard entire Stacks & Applications against unexpected changes 9
Inc. or its affiliates. Integrations between Constructs (cont.) When Compute Service does some work Then I want Analytics Service to process logs 13 Compute Service Construct Analytics Service Construct
Inc. or its affiliates. Incoming Change Synth any changes Diff Continue only if different Deploy test cases with updates Assert functionality Accept and commit new snapshot 15 integ-runner
Inc. or its affiliates. Integration tests with integ-runner Assert how Constructs interact Actual deployments Simulate real behavior Contract testing Works with all languages 16 Usage: integ-runner [TEST...] [--language python] Example: integ-runner integ-compute-analytics –l python
Inc. or its affiliates. What’s next for integ-runner? Improvements Stabilize API for assertions Stabilize API for Custom Assertions i.e. calling a Custom Assertion Resource Automatically detect Dotnet, Java Framework for long-running assertions e.g. AWS CodeBuild or AWS StepFunctions Ideas for Community Constructs Contract testing e.g. integration with Pact Load testing e.g. integration with Artillery Front end testing e.g. Amazon CloudWatch Synthetics 18 Your ideas?