We are trying to adopt some CI practices and methodologies into our organization. I'm currently reading over some of the points in Continuous Delivery book written by Jez Humble and David Farley. And the point that I am debating is when unit tests should be run - before or after git commits. The book seems to suggest running unit tests after you check in, as a part of a commit test suite.But wouldn't it make more sense to conduct unit tests before checking in?Any comments would be appreciated.
when should unit tests be done in a continuous integration environment
continuous integration;continuous delivery
Usually the developer runs them manually before checking in, and a CI server runs them automatically after checking in.  Programmers are usually pretty good about running unit tests for incremental builds on the configuration they've been working on, but they don't do things like do a clean build from a completely clean checkout from version control, run tests for all configurations of a product, run all the unit tests for the downstream projects that depend on theirs, etc.  That's why CI servers rerun the tests after commit.  You can configure them to run the tests before they actually get merged into a master branch, if you want a branch that definitely has had all the tests run.