DOP-C02 Question 34
Select 3Your team is implementing a CI/CD pipeline for a microservices-based application deployed on AWS. You want to ensure that appropriate types of tests are executed at different stages of the pipeline to optimize build time while maintaining high code quality. Which combination of test types should be used at the respective stages of the pipeline to achieve these goals?
- A
Perform unit tests during the source stage to validate individual components of the codebase.
- B
Execute integration tests during the build stage to validate the interactions between multiple services.
- C
Run load tests during the deploy stage to validate application performance under high traffic.
- D
Perform end-to-end tests during the staging stage to simulate real-world user workflows.
- E
Conduct static code analysis during the deploy stage to catch code quality issues before deployment.
Show answer and explanation
Correct answers: A, C, D
Explanation
To optimize CI/CD pipelines, different types of tests need to be executed at appropriate stages. Unit tests are lightweight and validate individual units of code, making them ideal for the source stage. Load tests focus on performance and scalability, which fits the deploy stage. End-to-end tests are resource-intensive and validate user workflows, suitable for the staging stage. By aligning test types with the CI/CD stages, the pipeline remains efficient while ensuring code quality.
- A. Correct.
Unit tests are fast, lightweight, and best suited to the source stage to validate the functionality of individual components in isolation.
- B. Incorrect.
Integration tests are usually more time-intensive and should be executed after the source stage, typically during the build or test stage, but not in the build stage for this scenario as it might delay the pipeline.
- C. Correct.
Load tests are resource-intensive and are best suited for the deploy stage to validate the application’s behavior under production-like traffic conditions.
- D. Correct.
End-to-end tests are typically executed in the staging stage to simulate real-world workflows and ensure the application behaves as expected in an environment similar to production.
- E. Incorrect.
Static code analysis should be performed during the source or build stage, not during the deploy stage, as the deploy stage focuses on validating the deployed application in a production-like environment.