0

I want to set up a gated checked-in policy for my project using TFS 2013 and VS 2013. I want to set up a process that before dev, checked in Unit Test and Code Quality analysis should run. I want to use Nunit for unit Test purposes. Can anybody share an example of how to set up the process?

weegee
  • 3,256
  • 2
  • 18
  • 32
Sandeep B
  • 3
  • 1
  • 1
    Welcome to StackOverflow. What did you try so far, and how did the result differ from what you expected? – Bex Sep 01 '15 at 04:18
  • Do you want a gated check-in on build, or do you want a Check-in policy?The first does what every checks you configure before the code is commited, otherwise it's left on the shelf, the second runs in VS that ensures the developer has done a build / test on their machine - and can more easily be bypassed. – DaveShaw Sep 01 '15 at 19:36
  • Thanks for reply. But I want to implement first option i.e. gated check-in which allow developer to check-in code if all Tests are successful only. – Sandeep B Sep 02 '15 at 04:59

1 Answers1

1

Create a new build definition with a "Trigger of Gated" like so:

Trigger set to Gated

Then goto the "Process" tab and set it so that it does as many of the following as you like:

  1. Run Tests.
  2. Perform Code Analysis always.
  3. Pass MSBuild args to treat warnings as errors.

enter image description here

DaveShaw
  • 52,123
  • 16
  • 112
  • 141
  • Thanks DaveShaw!! Is it possible to integrate FXCop and Nunit in Gated check-in OR any other tools? – Sandeep B Sep 04 '15 at 04:44
  • Yes, FXCop is just code analysis, nUnit tests just need configuring to run on the build server, I'm sure there's a nunit on TFS guide somewhere. – DaveShaw Sep 04 '15 at 07:09