Software Testing Case Studies & Practical Application 4 — Questions and Answers
Question 1: A team inherits a legacy codebase with no tests. They want to add tests safely without inadvertently altering behavior. What is the recommended first step?
- Rewrite all modules using TDD
- Write characterization tests to document current behavior before refactoring (Correct answer)
- Achieve 100% branch coverage immediately
- Deploy to production and monitor logs for errors
Correct answer: Write characterization tests to document current behavior before refactoring
Characterization tests capture the existing (possibly buggy) behavior of legacy code so that refactoring can proceed without inadvertently changing that behavior.
Question 2: A QA team must test a black-box system that accepts a numeric rating from 1 to 5. Using equivalence partitioning, which set of test values is most efficient?
- 1, 3, 5
- 0, 3, 6 (Correct answer)
- 1, 2, 3, 4, 5
- –1, 0, 3, 5, 6
Correct answer: 0, 3, 6
Equivalence partitioning divides inputs into valid (1–5) and invalid (<1, >5) partitions; one representative from each—such as 0, 3, and 6—covers all partitions efficiently.
Question 3: An automated test suite takes 4 hours to run and blocks the CI pipeline. The fastest way to reduce feedback time while maintaining coverage is:
- Eliminate all end-to-end tests
- Parallelize test execution across multiple agents (Correct answer)
- Convert all tests to manual
- Remove all tests that take more than 10 seconds
Correct answer: Parallelize test execution across multiple agents
Parallelizing test execution distributes the workload across multiple machines or agents, reducing total wall-clock time while maintaining the same coverage.
Question 4: A financial application crashes with a stack overflow error only after running for 72 hours in production. Which testing approach is designed to detect this class of defect?
- Smoke testing
- Soak (endurance) testing (Correct answer)
- Spike testing
- Exploratory testing
Correct answer: Soak (endurance) testing
Soak testing runs the system under normal load for an extended period to uncover memory leaks, resource exhaustion, and other degradation issues that only appear over time.
Question 5: A tester changes a condition in the source code from '>' to '>=' and reruns the test suite. All tests still pass. What does this indicate?
- The code has no defects
- The test suite has insufficient mutation coverage for this condition (Correct answer)
- The mutation was semantically equivalent
- The CI environment is misconfigured
Correct answer: The test suite has insufficient mutation coverage for this condition
In mutation testing, a surviving mutant (one not killed by the test suite) indicates the tests do not adequately cover or assert the behavior affected by that specific code change.
Question 6: A company is releasing a new payment feature and wants real users to test it before full rollout. They enable it for 5% of users and monitor error rates. This practice is called:
- A/B testing
- Canary release testing (Correct answer)
- Beta testing
- Shadow testing
Correct answer: Canary release testing
A canary release gradually rolls out a change to a small subset of users, allowing teams to detect issues and roll back before full deployment.
Question 7: After adding a new payment gateway, the team must verify that the entire purchase flow—from browsing to order confirmation email—still works correctly. This is best achieved through:
- Unit testing the payment module in isolation
- End-to-end testing of the full user journey (Correct answer)
- Static code analysis
- Component testing of the gateway API adapter
Correct answer: End-to-end testing of the full user journey
End-to-end testing validates complete user journeys across all integrated components, ensuring the entire flow works as a system.
A team inherits a legacy codebase with no tests.
They want to add tests safely without inadvertently altering behavior.
What is the recommended first step?