Skip to content

DevOpsDays Kraków 2024 - Test-oriented Cloud Application Architecture

Wojciech Dąbrowski

CloudPROIDEA Events46 minOpen on YouTube ↗

Wojciech Dąbrowski details DevOpsDays Kraków 2024 - Test-oriented Cloud Application Architecture.

Summary

### Overview In this DevOpsDays Kraków 2024 presentation, the speaker explores test-oriented cloud application architecture, breaking down testing strategies across traditional and cloud environments. Drawing from practical experience leading AWS initiatives, the talk examines why automated testing exists, categorizes test levels using the testing pyramid, and discusses architectural requirements for creating robust, isolated test environments in the cloud.

### Key Topics - **Purpose of Automated Testing**: Beyond verifying newly implemented functionality, automated tests primarily guard against regression, enable safe refactoring of code and cloud architectures (e.g., migrating from containers to serverless or altering databases), and act as a validation signal for underlying system design. - **Test Classification & Definitions**: - *Unit Tests*: Fine-grained tests evaluating business logic within isolated functions, classes, or methods. - *Integration Tests*: Tests specifically focused on verifying communication contracts between components or external APIs/data stores, rather than end-to-end flows. - *Component Tests*: Tests that evaluate application logic and flow within a bounded context without integrating real external services, typically utilizing fakes or stubs. - *End-to-End (E2E) Tests*: Black-box tests run against deployed environments that validate the complete application flow across real services without test doubles. - **Test Doubles**: Differentiating test double categories, specifically fakes (functional replacements like in-memory databases), stubs (pre-configured return values), and mocks (verifying invocation counts and payloads). - **Cloud Testing with AWS Examples**: Implementing tests across a typical cloud pattern (API Gateway, AWS Lambda, Amazon S3, and DynamoDB). Clean code and inversion of control underpin unit testing, while architectural patterns like hexagonal or onion architecture enable effective component testing. - **Infrastructure as Code (IaC) & Test Environments**: Creating on-demand testing environments requires repeatable, parameterized IaC templates (e.g., AWS CloudFormation or Terraform). Anti-patterns that prevent isolated testing include hardcoded resource names, tightly coupled cross-stack dependencies, and distributed monoliths. - **Testing Myths & Professional Mindset**: Refutation of common development excuses, including the claim that systems are too unique to test, the belief that MVPs do not need testable architecture, and the habit of writing untested code due to shifting ticket requirements.

### Technical Details - **Inversion of Control & Clean Architecture**: Keeping core application logic independent of concrete implementation details (such as direct cloud SDK calls to DynamoDB or S3) allows developers to swap real storage engines for test doubles during unit and component testing. - **IaC Parameterization**: Hardcoding resource names or external service identifiers into CloudFormation stacks or Terraform modules creates collisions that prevent deploying isolated preview or branch-level environments on demand. - **Distributed Monolith Pitfall**: Microservices that share distributed transactions or lack bounded context autonomy force end-to-end testing across massive, interconnected environments rather than allowing independent component verification.

### Takeaways - Even in serverless or cloud-native architectures where integration configurations are prevalent, the traditional testing pyramid remains valid, emphasizing fast, maintainable unit tests. - Code should always be written to be 'test-ready' from the start, as untestable code introduces architectural debt that cannot easily be retrofitted. - Engineers must understand requirements deeply rather than blindly implementing tickets, ensuring systems are decomposed into testable, loosely coupled boundaries.

Related talks