Q93 — AWS DVA-C02 Ch.2
Question 93 of 100 | ← Chapter 2
A company is developing a serverless multi-tier application on AWS. The company will build the serverless logic layer using Amazon API Gateway and AWS Lambda. While building the logic layer, frontend developers working on the application must develop integration tests. Tests must cover positive and negative scenarios, specifically based on successful and error HTTP status codes. Which solution meets these requirements with the least effort?
- A. Configure a mock integration for the API method in API Gateway. In the integration request, add simple logic to return success or error based on HTTP status codes. In the integration response, add messages corresponding to the HTTP status codes. ✓
- B. Create two mock integration resources for the API method in API Gateway. In the integration request, configure one resource to return a success HTTP status code and the other to return an error HTTP status code. In the integration response, add messages corresponding to the HTTP status codes.
- C. Create a Lambda function to execute tests. Add simple logic to return success or error based on HTTP status codes. Build an API Gateway Lambda integration. Select the appropriate Lambda function corresponding to the HTTP status code.
- D. Create a Lambda function to execute tests. Add simple logic to return success or error HTTP status codes. Create a mock integration in API Gateway. Select the Lambda function corresponding to the HTTP status code.
Correct Answer: A. Configure a mock integration for the API method in API Gateway. In the integration request, add simple logic to return success or error based on HTTP status codes. In the integration response, add messages corresponding to the HTTP status codes.
Explanation
Option A is optimal because API Gateway mock integrations allow simulating backend behavior without invoking actual Lambda functions. Simple logic in the integration request can conditionally return success or error status codes, and integration responses can map messages to those codes — enabling full test coverage of HTTP status handling with zero backend dependencies. Option B adds unnecessary complexity by requiring two separate resources. Options C and D require deploying and managing additional Lambda functions and integrations, increasing development and operational overhead. Thus, A delivers the required functionality with minimal effort.