AWS Certified Developer – Associate — Question 21
A Company runs continuous integration/continuous delivery (CI/CD) pipelines for its application on AWS CodePipeline. A Developer must write unit tests and run them as part of the pipelines before staging the artifacts for testing.
How should the Developer incorporate unit tests as part of CI/CD pipelines?
Answer options
- A. Create a separate CodePipeline pipeline to run unit tests
- B. Update the AWS CodeBuild specification to include a phase for running unit tests
- C. Install the AWS CodeDeploy agent on an Amazon EC2 instance to run unit tests
- D. Create a testing branch in AWS CodeCommit to run unit tests
Correct answer: B
Explanation
The correct answer is B, as updating the AWS CodeBuild specification allows the developer to integrate unit tests directly into the build process, ensuring they run during the pipeline. Option A is incorrect because creating a separate pipeline would complicate the process. Option C is not suitable since AWS CodeDeploy is not intended for running tests, and option D does not effectively integrate tests into the CI/CD pipeline.