New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Amazon DOP-C02 Exam - Topic 6 Question 40 Discussion

Actual exam question for Amazon's DOP-C02 exam
Question #: 40
Topic #: 6
[All DOP-C02 Questions]

A software team is using AWS CodePipeline to automate its Java application release pipeline The pipeline consists of a source stage, then a build stage, and then a deploy stage. Each stage contains a single action that has a runOrder value of 1.

The team wants to integrate unit tests into the existing release pipeline. The team needs a solution that deploys only the code changes that pass all unit tests.

Which solution will meet these requirements?

Show Suggested Answer Hide Answer
Suggested Answer: B

* Modify the Build Stage to Add a Test Action with a RunOrder Value of 2:

The build stage in AWS CodePipeline can have multiple actions. By adding a test action with a runOrder value of 2, the test action will execute after the initial build action completes.

* Use AWS CodeBuild as the Action Provider to Run Unit Tests:

AWS CodeBuild is a fully managed build service that compiles source code, runs tests, and produces software packages.

Using CodeBuild to run unit tests ensures that the tests are executed in a controlled environment and that only the code changes that pass the unit tests proceed to the deploy stage.

Example configuration in CodePipeline:

{

'name': 'BuildStage',

'actions': [

{

'name': 'Build',

'actionTypeId': {

'category': 'Build',

'owner': 'AWS',

'provider': 'CodeBuild',

'version': '1'

},

'runOrder': 1

},

{

'name': 'Test',

'actionTypeId': {

'category': 'Test',

'owner': 'AWS',

'provider': 'CodeBuild',

'version': '1'

},

'runOrder': 2

}

]

}

By integrating the unit tests into the build stage and ensuring they run after the build process, the pipeline guarantees that only code changes passing all unit tests are deployed.


AWS CodePipeline

AWS CodeBuild

Using CodeBuild with CodePipeline

Contribute your Thoughts:

0/2000 characters
Charolette
3 months ago
I’m surprised there’s even an option to test in the deploy stage!
upvoted 0 times
...
Beatriz
3 months ago
Definitely not C, tests should be in the build stage, not deploy.
upvoted 0 times
...
Lakeesha
3 months ago
Wait, why would you add tests in the deploy stage? That seems risky.
upvoted 0 times
...
Mary
4 months ago
I think A is better, CodeDeploy is more suited for this.
upvoted 0 times
...
Tequila
4 months ago
Option B seems right, using CodeBuild for unit tests is standard.
upvoted 0 times
...
Leonida
4 months ago
I feel like the deploy stage isn't the right place for unit tests. It should be in the build stage, but I’m not sure if it should be runOrder 1 or 2.
upvoted 0 times
...
Adria
4 months ago
I practiced a similar question where we had to integrate tests into a pipeline. I think modifying the build stage makes sense, but I can't recall if the runOrder should be 1 or 2.
upvoted 0 times
...
Helga
4 months ago
I'm a bit unsure about whether to use CodeDeploy or CodeBuild for running unit tests. I feel like CodeBuild is more commonly used for that purpose.
upvoted 0 times
...
Barrie
5 months ago
I remember we discussed how the runOrder value affects the sequence of actions in the pipeline. I think adding a test action with a runOrder of 2 might be the right approach.
upvoted 0 times
...
Stevie
5 months ago
This seems like a tricky one, but I think I've got a handle on it. I'm leaning towards option B - adding the test action to the build stage with a runOrder of 2. That way, the build will happen first, and then the tests will run before the deployment.
upvoted 0 times
...
Laquita
5 months ago
I'm not sure about using CodeDeploy versus CodeBuild for the unit tests. I'll need to think through the pros and cons of each option to decide which one is the better fit.
upvoted 0 times
...
Lili
5 months ago
Okay, I've got a strategy here. I think the best approach is to add the unit test action to the build stage, with a runOrder of 1. That way, the tests will run before the deployment, and only the passing code will get deployed.
upvoted 0 times
...
Alonso
5 months ago
Hmm, I'm a bit confused about the runOrder values and how that affects the order of the actions. I'll need to review that part of the question carefully.
upvoted 0 times
...
Matthew
5 months ago
This seems like a straightforward question. I think the key is to integrate the unit tests into the existing pipeline, and make sure they run before the deployment stage.
upvoted 0 times
...
Micaela
1 year ago
Definitely B. Running the tests in the build stage ensures that only the code that passes all the checks gets deployed. Can't afford any buggy releases, am I right?
upvoted 0 times
Remedios
1 year ago
Absolutely, having tests in the build stage ensures that only the code changes that pass all unit tests are deployed.
upvoted 0 times
...
Michell
1 year ago
I prefer option B as well. It's crucial to have a reliable testing process in place before deployment.
upvoted 0 times
...
Malcom
1 year ago
Agreed, we can't afford any buggy releases. It's important to have those checks in place.
upvoted 0 times
...
Rosio
1 year ago
I think B is the best option. Running tests in the build stage makes sure only code that passes gets deployed.
upvoted 0 times
...
...
Carolann
1 year ago
Whoa, hold up! Wouldn't it be hilarious if they tried to run the tests in the deploy stage? That's like putting the cart before the horse, am I right? I vote for B.
upvoted 0 times
Mollie
1 year ago
Agreed, B is the best solution to ensure only code changes that pass unit tests are deployed.
upvoted 0 times
...
Felicitas
1 year ago
Definitely, it's better to have tests in the build stage. B is the way to go.
upvoted 0 times
...
Kimberlie
1 year ago
Yeah, it's important to catch any issues before deploying. B seems like the safer choice.
upvoted 0 times
...
Christene
1 year ago
I agree, running tests in the deploy stage seems risky. B sounds like a better option.
upvoted 0 times
...
...
Ines
1 year ago
Hmm, I'm not sure about that. I was thinking C might be the better option, where we add the test action with a runOrder of 1 in the deploy stage using AWS CodeDeploy.
upvoted 0 times
...
Rachael
1 year ago
But A uses AWS CodeDeploy to run unit tests, which makes more sense in this scenario.
upvoted 0 times
...
Alex
1 year ago
I think the answer is B. Modifying the build stage and adding a test action with a runOrder of 2 using AWS CodeBuild makes the most sense to me.
upvoted 0 times
Quentin
1 year ago
That sounds like a good plan. It's important to have the unit tests integrated into the pipeline to ensure only code changes that pass the tests are deployed.
upvoted 0 times
...
Glenna
1 year ago
I agree with you. Using AWS CodeBuild in the build stage for running unit tests seems like the right approach.
upvoted 0 times
...
Shawana
1 year ago
I see your point, but I think adding it to the build stage ensures that only code changes that pass unit tests get deployed.
upvoted 0 times
...
Johna
1 year ago
I think the answer is B. Modifying the build stage and adding a test action with a runOrder of 2 using AWS CodeBuild makes the most sense to me.
upvoted 0 times
...
Rikki
1 year ago
But wouldn't it be better to add the test action in the deploy stage instead of the build stage?
upvoted 0 times
...
Merri
1 year ago
I agree, using AWS CodeBuild for running unit tests in the build stage seems like the right approach.
upvoted 0 times
...
Talia
1 year ago
I think the answer is B. Modifying the build stage and adding a test action with a runOrder of 2 using AWS CodeBuild makes the most sense to me.
upvoted 0 times
...
...
Francesco
1 year ago
I disagree, I believe the correct answer is B.
upvoted 0 times
...
Rachael
1 year ago
I think the answer is A.
upvoted 0 times
...

Save Cancel