TDD developer

December 1, 2008

Use NAnt to run mbunit tests using gallio

Filed under: Uncategorized — makka @ 7:55 pm
Tags: , ,

Gallio has a great build-in support for NAnt!
Unfortunately at the moment this is not well document so if you need to create a target to execute all tests inside an assembly you can write this xml fragment inside your NAnt project file:

<target name=”test” depends=”build”>
  <gallio
    result-property=”exitCode”
    failonerror=”false” >
    <runner-extension value=”TeamCityExtension,Gallio.TeamCityIntegration” />
    <assemblies>
      <!– Specify the tests assemblies –>
      <include name=”${src.dir}Data.Fixturebin${project.config}Data.Fixture.dll”/>
    </assemblies>
  </gallio>
  <fail if=”${exitCode != ‘0′}” >One or more tests failed. Please check the log for more details</fail>   
</target>

don’t forget to load Gallio NAnt Tasks before start with this line of xml

<loadtasks assembly=”.toolsGallioGallio.NAntTasks.dll” />

If you need more information you can take a look at comment in the source code here

Technorati Tag: ,,

7 Comments »

  1. Some more info here:
    http://www.gallio.org/api/html/T_Gallio_NAntTasks_GallioTask_Members.html

    Would you be interested in contributing a chapter to the Gallio book about setting up Gallio for use with NAnt?

    Comment by Jeff Brown — December 1, 2008 @ 9:16 pm | Reply

  2. Note that in v3.1 the “assemblies” element has been renamed to “files” since Gallio now supports running test files of other kinds, such as RSpec tests.

    Comment by Jeff Brown — September 2, 2009 @ 9:13 am | Reply

  3. Here’s an updated link to the API docs in case anyone stumbles on this post:
    http://www.gallio.org/api/html/T_Gallio_NAntTasks_GallioTask.htm

    Comment by Jeff Brown — September 2, 2009 @ 9:14 am | Reply

  4. Last comment… the TeamCity integration extension no longer needs to be added manually. Gallio v3.1 will automatically detect when it is running as part of a TeamCity build process. :-)

    Comment by Jeff Brown — September 2, 2009 @ 9:19 am | Reply

  5. I created a universal NAnt script for Gallio. http://ferventcoder.com/archive/2009/09/20/universal-nant-script-for-gallio.aspx

    The only thing I need to figure out is how to get Gallio into source control of each project without a 26.4MB hit. I tried putting only GallioNAntTasks.dll and Gallio.dll into source, but it kept running into errors. When I point to the full install, I’m golden.

    Comment by Robz — September 20, 2009 @ 3:41 pm | Reply

    • @Robz
      You need to include all of the relevant plugins and their files. We have some work in progress on a tool (Gallio.Copy) that will make it easy to copy a subset of Gallio into a directory of your choice.

      If you look inside the *.plugin file, you’ll find the list of all of the files that the plugin requires. For your purposes you probably need the following plugins: Gallio, NAnt, MbUnit.

      Comment by Jeff Brown — September 27, 2009 @ 7:17 pm | Reply

      • Oops, you probably need the Gallio.Reports plugin too.

        Comment by Jeff Brown — September 27, 2009 @ 8:13 pm


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.