DVA-C02 exam dumps

DVA-C02 practice question 250 of 399

AWS Certified Developer - Associate. Associate level, Amazon Web Services. Free question with the correct answer and a full explanation.

DVA-C02 Question 250

Single answer

You are developing a serverless application using AWS Lambda and API Gateway. To ensure reliable integration testing, you decide to use mock endpoints for external API dependencies. Which approach should you take to simulate these external dependencies and validate your code's logic without invoking actual APIs?

  1. A

    Use API Gateway's MOCK integration feature to simulate responses from external APIs.

  2. B

    Use AWS X-Ray to record the external API calls and replay them during tests.

  3. C

    Use a local Lambda function to deploy a temporary endpoint that mimics the external API.

  4. D

    Use a testing library like AWS SDK Mock to stub the API responses during the test.

Show answer and explanation

Correct answer: A

Explanation

API Gateway's MOCK integration is a built-in feature that allows developers to simulate external API responses without requiring live endpoints. This is a highly efficient and cost-effective way to perform integration testing in a controlled environment, especially for serverless applications relying on external dependencies.

  • A. Correct.

    Correct: API Gateway's MOCK integration allows you to define static responses to simulate external API behavior, making it ideal for integration testing without invoking real APIs.

  • B. Incorrect.

    Incorrect: AWS X-Ray is used for distributed tracing and debugging, not for simulating or mocking external API calls.

  • C. Incorrect.

    Incorrect: Deploying a local Lambda function for this purpose is unnecessary and may add complexity to testing. A mock approach is more efficient.

  • D. Incorrect.

    Incorrect: While AWS SDK Mock can stub AWS service calls, it does not directly simulate external APIs managed through API Gateway.

Timed practice exam

Take a DVA-C02 practice test under exam conditions

65 questions in 130 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam