views:

1133

answers:

4

What is the best way to run your suite of unit tests after each commit?

I'm particularly interested in the case that you do all of your features/changes in branches and keep your trunk stable.

My source control is SVN and I use tortoise SVN as my client.

Is there an SVN event or something along those lines that I can call a .cmd/.bat file?

If the answer is cruisecontrol, how do you check all branches with cruise control?

A: 

I would setup an automated build/deployment process as well. Check out Cruise Control - it can run the unit tests before deploying.

http://cruisecontrol.sourceforge.net/

Per Hornshøj-Schierbeck
I actually do use cruise control but don't know how to detect changes in each and every branch as soon as any commit occurs.
Brian R. Bondy
+2  A: 

You need a Continuous Integration Server like CruiseControl. This will monitor svn for changes, fire builds on a commit, follow it up with a test-suite run and flag any errors directly in your system tray (or email or whatever notification you feel comfortable with) You need to setup your CruiseControl by writing a small script (XML mostly) that defines your project needs. Recommended.. you won't go back once you've tasted it. Here's one that I set up back in the day

Update: I don't think there is a global check all branches type of setting. Each branch should be a different trunk url... which means a different project for CruiseControl. If you follow the recommended way of subversion branching (see here), Since CruiseControl itself seems to be using branches in Subversion.. this seems to be the way to go.

Gishu
How to check all branches with cruise control?
Brian R. Bondy
http://github.com/martinrehfeld/cruisecontrol.rb/commit/626397f14917aabd5780385d8e7e583c2c0fd875 should be a --branch option in source control configuration... still looking
Gishu
+5  A: 

I would think that you should probably be running your unit tests before the commit. If you are going to test at every commit, you should do it early enough to reject breaking changes.

You can do this with subversion hooks. If you add a pre-commit hook, you can do a build/test before the commit occurs. The hook script will execute on the server.

Derek Park
A: 

Use Buildbot.

This has a utility called svn_buildbot.py that can be called from your subversion post-commit script.

Buildbot is subversion away (as well as a number of other VC systems), so can be configured to pull new revisions from branches that you've committed into. It also provides email notifications and a web interface for status checking and forcing builds at a particular revision/branch.