Development Environment Testing
Unlock the complete study guide + 1,040 practice questions across 16 full exams.
Bundled into the existing AWS Certified Developer - Associate premium course — no separate purchase.
Included in this chapter:
- The testing ladder: from in-process unit tests to a deployed test stack
- Local emulation: the four sam local subcommands and generated events
- Validate and lint the template before you deploy it
- Mocking AWS calls, isolating test traffic, and CI execution
- What SAM local cannot emulate, and exam pattern recognition
| Approach | What it runs | Needs AWS deploy? | Catches | Best for |
|---|---|---|---|---|
| Unit test (mocked SDK) | Handler logic in-process with stubbed AWS clients | No | Logic bugs, branch coverage | Fast inner loop, no Docker |
| `sam local invoke` / `start-api` | Function in a local Docker Lambda-like container | No | Event-shape, handler/runtime, route mapping bugs | Local end-to-end before deploy |
| Deployed test stage / account | Real Lambda + real triggers in an isolated env | Yes (test stage/account) | IAM, integration, latency, quota issues | Integration tests against the real stack |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.
References
- Introduction to testing with the sam local command
- Intro to sam local invoke
- Intro to sam local start-api
- Intro to sam local generate-event
- sam validate command reference
- Validate AWS SAM template files with AWS CloudFormation Linter
- Set up stages for a REST API in API Gateway
- Intro to sam local start-lambda
- Testing Lambda functions in the console
- IAM policy testing with the IAM policy simulator
- What is AWS CodeBuild?