Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run unit test before check in

Using Visual Studio and TFS & preferably Specflow or standard unit test.

I want devs to run ALL unit test as a policy before check in. If a unit test breaks, then vS should stop them from checking in, just like when running across a merge conflict.

I know there're post build scripts that will do this, but really if unit test breaks, I rather that it doesn't get into source control at all. Plus the turn around is rather slow to wait for the full build. And then there's the bickering on who breaks whose stuff.

So no, I want unit test to pass locally before a check in. How would I do that? Yes they can just hit the button, but I like to get them a bit more "incentive" than that.

like image 200
Alwyn Avatar asked Oct 19 '12 19:10

Alwyn


1 Answers

It sounds like what you're after is a TFS Gated Check-in. This can ensure that the code builds, merges and that tests run successfully prior to committing the check-in. You can read more about it here:

An introduction to gated check-in

It's worth noting that it's a much slower process than CI builds, so depending on how many check-ins your developers are doing you may be better off looking at a CI build with 'Create Work Item on Failure' enabled and a Project Alert set up to notify the developer that they broke the build.

like image 197
Town Avatar answered Sep 22 '22 05:09

Town