Unit tests during technical interview

PyLadies iQea15
Nov 4, 2018 12 Comments

During a technical interview, do you write and run unit tests? If so, do you use a testing framework of your choice or just the standard library?

comments

Want to comment? LOG IN or SIGN UP
TOP 12 Comments
  • Absolutely write unit tests. Nothing is more irritating than a candidate that writes a bunch of buggy code on the whiteboard and smugly says they’re done. Of course don’t bother actually writing full test code. Just write shorthand pseudo code of input and expected output to properly cover your code.

    I always write my test cases on the corner of the whiteboard first before writing the code and constantly refer to them.

    Is really so easy and shows you’re an experienced professional because you will catch your errors before the interviewer has a chance to ding you on your bugs.

    In reality, I’ve only seen folks from google actually do this.
    Nov 4, 2018 0
  • Amazon Wilfisk
    Lol is this a serious question
    Nov 4, 2018 2
    • PyLadies iQea15
      OP
      Yup. I haven't interviewed since I got my first job and that was with a limited sample.
      Nov 4, 2018
    • Amazon Wilfisk
      U are suppose to run through ur code through thinking out loud after writing it on the board. U will be expected to run it on sample happy path, edge cases and failure. Remember every min in that 45 min interview is precious. You dont want to waste it writing junit cases.
      Nov 4, 2018
  • Microsoft BarFoo
    No, you don’t write a separate unit test function, but if you list out all of your test cases, you get bonus points. More bonus points if you list all the variations I can think of, and even more if you add valid ones I didn’t think of. This is assuming it’s an in-person or real-time interview. If it’s one where you write code offline and submit it, then yes, I hope you have test cases...
    Nov 4, 2018 0
  • Microsoft SatyasMama
    Yes if you want to stand out. I’ve seen way too many developers that can’t write tests. If you can it’s a very good sign
    Nov 4, 2018 0
  • On a whiteboard no.
    When yr submitting a solution that you code up on a laptop, why wouldn’t you? IMO you will produce code that can test for edge cases etc.
    Nov 4, 2018 0
  • Amazon / PR jefe_bezos
    It’s likely you’ll be asked “how” to test your function but you won’t actually write any. (input validation, edge cases, bounds, blah blah blah... you may get some bonus points on concurrency and scalability concerns)
    Nov 4, 2018 0
  • Amazon / Eng booooooo
    No, unless they ask, which is very rare
    Nov 4, 2018 0
  • PyLadies iQea15
    OP
    Thanks everyone!
    Nov 4, 2018 0
  • Pandora Total44.00
    Not on a whiteboard, no. I’ve not heard of or seen it even with an IDE available. Could be brownie points if you do though.
    Nov 4, 2018 0
  • Amazon / Eng deJ2q8
    I just write down variables and run it on whiteboard.
    Nov 4, 2018 0

Salary
Comparison

    Real time salary information from verified employees