AWS Certified Developer – Associate (DVA-C02) — Question 129

A developer is creating an AWS Lambda function. The Lambda function will consume messages from an Amazon Simple Queue Service (Amazon SQS) queue. The developer wants to integrate unit testing as part of the function's continuous integration and continuous delivery (CI/CD) process.

How can the developer unit test the function?

Answer options

Correct answer: D

Explanation

The correct answer is D because using the aws lambda invoke command allows for quick testing of the Lambda function by directly invoking it with a predefined test event. The other options involve setting up additional resources or processes that are unnecessary for simple unit testing, making them less efficient for integration into a CI/CD process.