DOP-C02 Question 21
Select 2You are managing a CI/CD pipeline for an e-commerce application hosted on AWS. The pipeline uses AWS CodePipeline for orchestration, AWS CodeBuild for build steps, and AWS CodeDeploy for deployments. To ensure code quality and functionality, you need to integrate automated testing into the pipeline. Functional tests should be run after the build stage, and load tests should be run in a separate testing environment before deployment to production. Which actions should you take to meet the requirements?
- A
Add a post-build action in CodeBuild to execute the functional tests and fail the build if the tests fail.
- B
Create a new stage in CodePipeline to run load tests using an AWS Lambda function before the deployment stage.
- C
Use CodeDeploy hooks to execute functional tests before deploying the code to the production environment.
- D
Configure CodePipeline to trigger a separate pipeline for load testing after the build stage completes.
- E
Integrate AWS Device Farm into CodePipeline to manage both functional and load testing.
Show answer and explanation
Correct answers: A, B
Explanation
To integrate automated testing into a CI/CD pipeline, functional tests should be executed as part of the build stage using CodeBuild, which allows immediate feedback on code quality. Load tests should be run in a separate testing environment before deployment, which can be achieved by adding a dedicated stage in CodePipeline. These approaches ensure that the testing process is automated, seamless, and appropriately staged within the pipeline.
- A. Correct.
Correct: Adding a post-build action in CodeBuild to execute functional tests ensures that these tests are run immediately after the build stage and fail the pipeline if the tests fail. This aligns with the requirement to run functional tests after the build.
- B. Correct.
Correct: Creating a new stage in CodePipeline to run load tests using an AWS Lambda function ensures load tests are executed in a separate testing environment before deployment, fulfilling the requirement.
- C. Incorrect.
Incorrect: CodeDeploy hooks are primarily used for deployment-related tasks and not for running functional tests as part of a CI/CD pipeline.
- D. Incorrect.
Incorrect: Triggering a separate pipeline for load testing adds unnecessary complexity and does not ensure the load tests are fully integrated into the main pipeline.
- E. Incorrect.
Incorrect: AWS Device Farm is used for mobile and web app testing, and it is not suitable for managing functional or load tests in this scenario.