AWS Certified DevOps Engineer – ProfessionalSDLC AutomationHard

A software development team is adopting trunk-based development with frequent, small commits to the main branch. They want to ensure that every commit triggers a full suite of automated tests, including unit, integration, and static analysis, to maintain a high level of code quality and prevent regressions. The CI/CD pipeline should execute these tests quickly to provide rapid feedback. Which approach for test execution in AWS CodePipeline would best support this strategy?

  1. AExecute tests on developer workstations before committing code to the repository.
  2. BUse AWS Step Functions to orchestrate test execution on separate EC2 instances for each test type.
  3. CDistribute different test suites across multiple parallel CodeBuild projects within the same stage.
  4. DRun all tests sequentially in a single AWS CodeBuild project.
Show answer & explanation

Correct answer: C. Distribute different test suites across multiple parallel CodeBuild projects within the same stage.

To achieve rapid feedback in a trunk-based development model, parallelizing test execution is crucial. AWS CodePipeline allows configuring multiple CodeBuild actions (each representing a different test suite like unit, integration, SAST) to run in parallel within a single stage. This significantly reduces the overall test duration, providing faster feedback to developers.

Why the other options are wrong

  • A. While developers should run tests locally, relying solely on local execution is inconsistent and doesn't guarantee that all pipeline tests pass or prevent regressions once code is committed.
  • B. Using AWS Step Functions and separate EC2 instances for each test type is a complex and potentially more expensive solution than leveraging CodeBuild's parallel execution capabilities within CodePipeline for this scenario.
  • D. Running all tests sequentially would increase the total build time, slowing down feedback and hindering rapid iteration, which is critical for trunk-based development.

Parallel Test Execution

Running multiple test suites or individual tests concurrently rather than sequentially to reduce the total time required for test completion.

  • Speeds up CI/CD pipeline execution.
  • Crucial for rapid feedback in frequent commit environments.
  • Can be achieved by distributing tests across multiple resources.

Memory trick: Parallel tests are like multiple lanes on a highway, getting everyone to the finish line faster.

More SDLC Automation questions