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.
As a staff machine learning engineer you must define organization-level test SLAs and a policy for model changes. Create a concise policy document outline that covers required test types, minimal gating thresholds, rollout requirements, monitoring obligations, and exceptions. Explain how you would onboard teams to this policy.
Line coverage reports show 80% coverage for your ML library. Explain what meaningful test coverage looks like for an ML codebase and list at least five additional quality signals or metrics you would use to evaluate test quality beyond line coverage.
Write a pytest unit test snippet that serializes a simple PyTorch model to TorchScript, loads it back, and asserts that the output of the TorchScript model is close to the original model on a small deterministic input. Include tolerances and seed control.
How do you test asynchronous mobile code—such as callbacks, promises/futures, timers, or reactive streams—without using arbitrary sleeps? What patterns help keep those tests deterministic and fast?
Write a pytest example that demonstrates parametrized tests for multiple preprocessing scenarios (e.g., different imputers and scalers). Show how parametrization reduces duplication and improves coverage for combinations of preprocessing steps.
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.