Skip to content

AWS re:Invent 2025 - Supercharge Serverless testing: Accelerate development with Kiro (CNS427)

This presentation, "Supercharge Serverless testing: Accelerate development with Kiro (CNS427)," by Arthi and Tomas, focuses on simplifying serverless testing using agentic AI and good architectural practices.

Here are the key takeaways from the presentation:

Challenges with Serverless Testing (0:53-1:40)

  • Serverless applications are highly distributed and modular, leading to a larger number of integrations with cloud-native services.
  • Testing becomes complex due to the need to test integration layers and handle dependencies for isolated tests (mocking, emulating, or using AWS services).
  • Lambda functions themselves may not be complex enough, raising questions about coverage and where to focus testing efforts.
  • A common pitfall is that changes in integration architecture often require extensive changes to testing code (8:40-9:11).
  • Initial code was tightly coupled to infrastructure choices, causing tests to be rewritten when AWS services changed (10:10-10:22).
  • There was friction in developer experience due to the need to know exactly how services work for mocking (10:24-10:27).
  • There was room to improve test speed (10:31-10:34).

Introducing Kiro and Agentic AI for Architecture Review and Refactoring (11:10-18:52)

Kiro CLI and Custom Agents

Kiro CLI can be used with custom agents, which are configurable instances of Kiro CLI agents designed for specific tasks like architecture evaluation (12:23-12:55). These agents can be specialized for security auditing or compliance (12:56-13:05).

Automated Architecture Review

Kiro can review the current architecture, identify problems, and propose solutions, such as adopting a hexagonal architecture to decouple concerns (13:40-14:58, 15:58-16:22).

Spec-Driven Development with Kiro

Kiro can generate a plan for integrating suggested architectural changes using a "spec-driven" flow (15:09-15:40). This includes creating detailed requirements (17:31-17:49), design (17:51-18:12), and task lists (18:17-18:48).

Refactored Architecture

The refactored architecture makes the handler leaner, offloading business logic to a domain layer and communicating with services through interfaces and adapters, making it more flexible and easier to test (19:40-20:10).

Simplified Testing with Dependency Injection and In-Memory Fakes (24:00-34:36)

Decoupling Code

The re-architected code is no longer tightly coupled to infrastructure choices, meaning tests don't need to be rewritten if AWS services change (23:41-24:14).

Dependency Injection

By setting up the code for dependency injection, the get_task_service method allows for the injection of a fake task service during testing, simplifying the mocking process (24:43-25:51).

In-Memory Fakes

Using in-memory fakes instead of traditional mocks provides a highly configurable way to simulate different behaviors (success or error scenarios) of dependencies, making tests cleaner and less brittle compared to patching at runtime (28:16-29:55).

Faster Test Execution

In-memory fakes are significantly more lightweight and faster than mocking full AWS services, reducing test execution time (34:21-34:36).

Pure Functions

Domain logic functions that are pure and only depend on inputs can be tested very simply without complex setups (32:57-34:03).

Property-Based Testing for Algorithmic Correctness and Edge Cases (34:55-42:37)

Concept

Property-based testing defines properties of the code and generates a large number of inputs from a given problem space to test these properties, rather than relying on fixed inputs (35:57-36:10, 36:21-36:26, 37:35-37:38).

Benefits

It helps detect edge cases in business logic and verifies algorithmic correctness, especially for pure functions (36:24-36:26, 42:08-42:14). It can execute many tests (e.g., 100) during a single execution (36:06-36:09, 41:06-41:08).

Example (Circular Dependency)

Demonstrated with a circular dependency check, where the test generates various dependency graphs to ensure the logic correctly identifies circularities (37:37-40:15).

Visualization with Tiki

The Tiki plugin helps visualize what's happening under the hood, showing the number of test cases run, generated samples, and discarded samples. It also provides insights into failed inputs for easier troubleshooting (40:50-42:03).

Use Cases

Ideal for testing algorithmic correctness and pure functions, but less suited for end-to-end tests that require specific inputs to trigger workflows (42:08-42:26).


Presenter: Heitor Lessa - Principal Specialist Solutions Architect for Serverless at AWS