Archive

Archive for the ‘Machine.Specifications’ Category

Using Machine.Specifications with nant

October 20, 2009 1 comment

Wasted at least an hour today trying to track down an issue running my specs with NAnt. Turns out the problem was using <arg value=”{assembly1} {assembly 2}”  instead of <arg line=”{assembly1} {assembly2}” />.

The subtle difference between value and line is that value allows spaces and presents this to the exe as one argument by quoting the content of the attribute, whereas line passes the content of the attribute as it appears ( so the console runner sees 1 arg in the form “{assembly1} {assembly2}” instead of 2 separate args).  This problem presents itself as an error containing the following text :

Missing Assembly: {assembly1} {assembly2}

The xml for running machine.specifications with NAnt is:

    <target name="test.mspec" unless="${test.skip}">
        <mkdir dir="${test.specreportdir}" />
        <exec program="${test.mspecrunner}"
            basedir="${test.mspecdir}"
            workingdir="${root.dir}">
            <arg value="--silent" if="${teamcity.build}" />
            <arg value="--teamcity" if="${teamcity.build}" />
            <arg value="--html" /><arg dir="${test.specreportdir}" />
            <arg line="${test.assemblies}"/>
        </exec>
    </target>

where:

  • ${test.specreportdir} is the directory for the reports to go into
  • ${test.mspecrunner} is machine.specifications.consolerunner.exe
  • ${test.mspecdir} is the directory containing the mspec console runner
  • ${root.dir} is the root project directory
  • ${teamcity.build} is set from a team city specific build that is used for TC builds
  • ${test.assemblies} is a list of the assemblies containing specs separated by spaces
Follow

Get every new post delivered to your Inbox.