CS FundamentalsVery hardGATE CS · TCS NQT Prime · Product Company SDE

A build pipeline fails a merge if the newly added code's test coverage for that specific change falls below a configured threshold ('coverage gate on the diff', not on the whole codebase). What is the main motivation for scoping the gate to just the diff?

  1. A. It guarantees that the whole codebase will eventually reach 100% coverage automatically
  2. B. It disables testing entirely for any files that were not changed
  3. C. It lets a team enforce good testing habits on new code going forward without being blocked by a legacy codebase's pre-existing low overall coverage
  4. D. It is functionally identical to gating on total repository coverage

Correct answer: C. It lets a team enforce good testing habits on new code going forward without being blocked by a legacy codebase's pre-existing low overall coverage

Gating on just the changed lines lets teams hold new code to a higher testing standard immediately, without first needing to retroactively write tests for an entire pre-existing codebase before any merge could succeed.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic