AWS Certified Developer Associate DVA-C02 Practice Question
An application includes an AWS Lambda function that is triggered when an object is uploaded to an Amazon S3 bucket. The function extracts metadata from the file and stores it in an Amazon DynamoDB table. The development team is adding a CI workflow that will run unit tests on every commit. They want the tests to execute quickly on build servers without provisioning AWS resources or incurring charges, while still confirming that the function calls S3 and DynamoDB with the expected parameters. Which approach should they use?
Use a mocking framework or AWS SDK stubber to simulate Amazon S3 and Amazon DynamoDB in the unit tests.
Configure a Lambda alias named test and invoke that alias from the unit tests.
Create a dedicated developer AWS account and provision the S3 bucket and DynamoDB table as part of test setup.
Enable AWS X-Ray tracing and analyze the service calls recorded during test execution.
A mocking framework (or an AWS SDK stubber such as boto3's Stubber or the AWS SDK for JavaScript's mock-client) can replace the S3 and DynamoDB clients inside the unit tests. The mock objects intercept calls, return predefined responses, and allow assertions on the parameters the function sends-all without creating AWS resources or generating cost. Spinning up real S3 buckets and DynamoDB tables, invoking a separate Lambda alias, or enabling AWS X-Ray would either add cost, provisioning time, or fail to isolate the code under test, so they are less suitable for fast, repeatable unit tests.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
How does a mocking framework work in unit tests?
Open an interactive chat with Bash
What is the AWS SDK Stubber?
Open an interactive chat with Bash
Why is using real AWS resources not suitable for unit tests?
Open an interactive chat with Bash
AWS Certified Developer Associate DVA-C02
Deployment
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .