Testability and Shift-Left Testing Questions
Designing software to be testable and moving quality earlier in the lifecycle. Covers testability and design review, shift-left practices, collaborating with developers on quality at design time, and improving testability of existing code. Emphasizes preventing defects rather than only catching them.
Your company is deciding whether to invest heavily in automated test infrastructure versus maintaining a larger manual QA team. Create a cost-benefit analysis considering build and infra costs, speed to market, defect rates, customer impact, and long-term maintenance. Recommend a phased strategy that balances automation and manual testing.
Given a Flask REST endpoint that creates a user in Postgres, design an integration test that runs against a transactional test database. Include test setup and teardown, migrations, sample request/response assertions, and how to avoid tests modifying production data. Provide pytest-like pseudocode for the test harness.
Given the Python function below, write pytest unit tests that cover normal behavior, edge cases, and invalid input. Use parametrized tests where appropriate.
def is_anagram(a: str, b: str) -> bool:
# returns True if a is an anagram of b ignoring spaces and case
a_clean = ''.join(a.split()).lower()
b_clean = ''.join(b.split()).lower()
return sorted(a_clean) == sorted(b_clean)
Include tests for empty strings, different lengths, unicode characters, and punctuation-handling expectations.
Define smoke tests and regression tests. For a small web service propose a minimal smoke-test suite to run after deployment, explain why you would run smoke tests immediately and full regression less frequently, and describe trade-offs in the pipeline.
Design an approach and testing harness to deterministically test a concurrent algorithm that uses locks and shared state. Include techniques like deterministic schedulers, record-and-replay, model checking, and how to integrate these into CI to catch concurrency bugs without slowing developer feedback too much.
Unlock Full Question Bank
Get access to all Testability and Shift-Left Testing interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.