You're testing a function that approves a loan only when the applicant's age is between 18 and 65 inclusive. How would you systematically choose test cases for it, and why does that beat just writing a few examples you think of?

technical-conceptual · Senior level · software-engineering

What the interviewer is really asking

Assesses whether the candidate can apply equivalence partitioning and boundary value analysis deliberately, justify why boundaries are where defects cluster, and contrast a systematic technique with ad-hoc example-picking — a core senior test-design competency.

What to say

What to avoid

Example answers

Strong: I'd use equivalence partitioning plus boundary value analysis rather than random examples. The partitions are: below valid (under 18), valid (18 to 65), above valid (over 65), and invalid inputs. One representative per partition covers each behavior once. Then I attack the boundaries, because that's where the bugs are: 17, 18, 19 and 64, 65, 66 — those catch a < where it should be <= or an off-by-one on the inclusive range. I'd also test invalid inputs — negative, zero, non-numeric, null — against the documented behavior. The reason this beats a few examples I happen to think of is it's minimal, repeatable, and it forces the negative and edge cases in, which ad-hoc picking almost always skips.

Weak: I'd test a few ages — say 25, 40, and 60 to confirm they're approved, and maybe 10 and 80 to confirm they're rejected. That covers the valid and invalid ranges.

Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.