Talks AWS re:Invent 2025 - Supercharge Serverless testing: Accelerate development with Kiro (CNS427) VIDEO
AWS re:Invent 2025 - Supercharge Serverless testing: Accelerate development with Kiro (CNS427) Supercharging Serverless Testing with Kiro: Accelerating Development at AWS re:Invent 2025
Challenges with Serverless Applications
Serverless applications are highly distributed and modular, with a larger number of integrations compared to traditional apps
This makes it important to test the integration layers, and raises questions about how to handle dependencies for isolated tests
Lambda functions may not be complex enough, making it difficult to determine where to focus testing efforts
Evolving the Codebase for Testability
The initial codebase was tightly coupled to infrastructure choices, making it difficult to change the underlying AWS services without rewriting tests
The developer experience required detailed knowledge of mocking the AWS service APIs
There was room to improve the speed and efficiency of the tests
Leveraging Dependency Injection and In-Memory Fakes
Introduced dependency injection to decouple the handler code from the domain logic and integration layers
Created configurable in-memory fake services to simulate different test scenarios, rather than using brittle mocks
This simplified the test code and made it more resilient to changes in the domain logic
Property-Based Testing for Algorithmic Correctness
Used property-based testing with the Hypothesis library to validate the algorithmic correctness of the circular dependency check
Generated a large number of random test cases to thoroughly exercise the logic, rather than relying on a few fixed inputs
Provided detailed visualization and debugging capabilities to understand the generated test cases and identify issues
Integration Testing Against Real AWS Services
Tested the integration with DynamoDB and EventBridge using the actual AWS services, rather than mocks
Validated not only the happy path scenarios, but also the error handling and exception surfacing
Ensured the application behaved correctly when encountering integration failures, such as conflicts during offline task updates
Automating the Development Lifecycle with Kiro
Leveraged Kiro's custom agents and spec-driven development approach to automate the review, planning, and execution of the architectural changes
Used Kiro's property-based testing capabilities to generate comprehensive test suites for the domain logic
Integrated Kiro's bug analysis and risk heatmapping features to continuously monitor and improve the application's quality in production
Key Takeaways
Decouple the application architecture to simplify testing, using techniques like dependency injection and in-memory fakes
Leverage property-based testing to validate the algorithmic correctness of critical business logic
Test against real AWS services to ensure the application handles integration failures gracefully
Automate the development lifecycle with tools like Kiro to streamline the review, planning, and execution of architectural changes
Continuously monitor and improve the application's quality by analyzing production data and risks
Technical Details
Programming language: Python
Testing frameworks: Pytest, Hypothesis
Mocking library: Moto
Dependency injection: Custom module-level variable assignment
In-memory fake services: Configurable classes with controlled behavior
Property-based testing: Hypothesis library
Integration testing: Direct calls to AWS services (DynamoDB, EventBridge)
Automation: Kiro CLI, custom agents, spec-driven development
Business Impact
Improved developer productivity by reducing the effort required to maintain and evolve the codebase
Increased confidence in the application's correctness and reliability through comprehensive testing
Enabled faster iteration and innovation by streamlining the development lifecycle with Kiro's automation capabilities
Reduced the risk of production issues and customer impact by continuously monitoring and improving the application's quality
Examples
Circular dependency check in the domain logic, tested using property-based testing with Hypothesis
Integration with DynamoDB, including validation of error handling and conflict resolution
Integration with EventBridge, using a test harness to validate the published events
Your Digital Journey deserves a great story. Build one with us.