What should be done first: Code reviews or Unit tests?

Posted by goldenmean on Stack Overflow See other posts from Stack Overflow or by goldenmean
Published on 2009-02-09T06:26:48Z Indexed on 2010/03/26 14:43 UTC
Read the original article Hit count: 324

Hello,

If a developer implements code for some module and wants to get it reviewed. What should be the order :

*First unit test the module after designing test cases for the module, debugging and fixing the bugs and then give the modified code for peer code review

(Pros- Code to be reviewed is 'clean' to a good extent. Reduces some avoidable review comments and rework. Cons- Developer might spend large time debugging/fixing a bug which could have pointed/anticipated in peer code reviews)

Or

*First do the code review with peers and then go for unit testing.

What are your thoughts/experience on this?

I believe this approach for unit testing, code reviewing should be programming language agnostic, but it would be interesting to know otherwise(if applicable) with specific examples.

-AD

© Stack Overflow or respective owner

Related posts about code-review

Related posts about unit-testing