Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I was interviewed by a big internet company. After describing the problem to solve, the interviewer requested that I also submit test cases with the code via email.

I'm not sure if I should reveal the problem, but it was related to binary search trees. I wrote 4 test cases, varying from 0 to 10 nodes. I was rejected.

What are some guidelines to writing test cases for interviews?
(How big a case do interviewers expect? How many cases do interviewers expect? etc.)

share|improve this question

closed as not constructive by gnat, Frank Shearar, Graham Lee, Martijn Pieters, ChrisF Feb 26 '13 at 10:48

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

Just a side note, it is very possible you were not rejected because you were not good enough. It is quite possible they had someone in mind, or that they were waiting for an answer from a candidate they already offered the job to. –  Benjamin Gruenbaum Feb 25 '13 at 22:33

1 Answer 1

I'm going to assume that the guidlines would be the same as writing test cases for code.

Make sure all the boundary cases are covered. Make sure the nice case is covered. According to code complete you should have 1 test case for every if,for,while[,catch] statement in your code. Unfortunately the name for this general set of test cases eludes me right now.

I'll update when I get home with the exact specifics they were looking for.

Book I was taught this out of: http://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.