A CodePipeline has sequential source, build, and deploy stages, each with a single action at runOrder 1. The team needs to add unit tests so that only code that passes tests is deployed. How should they integrate unit testing into the pipeline?
Choose an answer
Tap an option to check your answer.
Correct answer: In the build stage, add a test action with runOrder 2 that uses AWS CodeBuild to run unit tests..
Why this is the answer
The correct option integrates unit testing into the build stage using AWS CodeBuild with a runOrder of 2. Unit tests should ideally run after the main build action (which is at runOrder 1) to ensure the compiled code is tested. CodeBuild is the appropriate service for running custom build and test commands. Placing tests in the build stage ensures that only code passing tests proceeds to deployment, preventing faulty code from reaching later stages. The other options are incorrect because: Adding a test action with runOrder 1 in the build stage would cause tests to run concurrently with or before the main build, which is usually not desired as tests often require compiled artifacts. Adding tests to the deploy stage is too late in the pipeline. Unit tests should validate code before deployment, not during or after. Using CodeDeploy for unit tests is incorrect; CodeDeploy is for deploying applications, not for executing unit tests.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed