Microsoft Interview Question
Software Engineer in TestsTeam: Azure
Country: United States
Depends entirely on what kind of coverage they are looking for and what's in the if blocks.
If they are interested in node/block coverage (like most CC%-counting tools) and there are no "return" or "throw" statements inside the if blocks, it'll take just one test case that goes into both if blocks.
The 4 cases are necessary for path coverage (2^2 since each if block can either be "true" or "false").
I think 4 cases...
- Basu February 25, 20121. One case to cover first if block (happy path for first IF)
2. One case to cover second if block (happy path for second IF)
3. Negative scenario which doesnt meet first IF block.
4. Negative scenario which doesnt meet second IF block.