How To: Skip Actions When Queuing a Build

One of the tasks we commonly build into our Team Build scripts is the ability to run FitNesse tests along with other tests (such as unit tests).  If any of the tests fail, we do not deploy the product for user acceptance testing.

The advantage to this approach is that we find out relatively quickly if we have “broke” the build if we have failing tests.  The down side to this is two-fold: 1) the build takes longer to run (not that big of an issue in our case) and 2) Sometimes we refactor code that should break the FitNesse tests.

In the latter case, it may take somebody several hours (or even sometimes, days) to review the failing tests and get them corrected.  In the meantime, none of our updates get deployed for further testing.

Properties to the Rescue

Some time ago, I wrote a short post explaining how to access the various properties, items, and meta data that you can define and/or make use of in your Team Build scripts.  By making use of a simple property declared within the build script we can allow the developers to queue a new build and override the execution of the FitNesse tests so the build can proceed.  Configuring the build script to achieve this requires three steps:

1. Create a custom property that will be used as a flag to determine whether the desired functionality should be executed or overridden (i.e. skipped).  In my example below, I named the property SkipFitNesse.

 
  false

2. Place the task(s) to be executed into a custom target specifying a condition.  For example:

 
  
 

Now that the build script is setup, you can manually override the execution of the FitNesse tests when you queue a new build by entering the following text into the command-line arguments field:

    /p:SkipFitNesse=true

For example:

queue

With this approach, the developers on our team now have a quick and simple method for skipping the execution of FitNesse tests if they are known to be in a “non-passing” condition and we want the build to continue.  This is only one example of how you might override the value of a property on the queue build dialog.  There are undoubtedly countless uses for this technique.

Also, if you’re interested in seeing how we execute FitNesse tests as part of our builds, check out this post.

ContactUs.com