Software Testing & QA (50 Qs)•Part 3: Advanced Internals, Scale & Production Quality (Senior / Lead)
CI/CD Test Suite Optimization: Test Sharding and Predictive Test Selection.
senior LevelMost AskedPerformanceCI/CD & DevOpsSystem Design
In Simple Words: As test suites grow to 5,000+ tests taking 45 minutes to execute:
- Test Sharding (
playwright test --shard=1/4): Splits the test files across 4 parallel CI runner VMs, slashing wall-clock execution time by 75%. - Predictive Test Selection (Affected Tests):
Using tools like Turborepo, Nx, or Jest's
--changedSince=origin/main: Analyzes the git diff and abstract syntax tree (AST) to execute only tests that directly import modified source files, skipping 90% of unaffected tests on pull requests.