Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cruise Control parsing "!" character in NAnt file

I have Cruise Control configured with a task to run a NAnt script, which runs an MSTest suite. MSTest allows me to specify test categories so I want to specify "!Integration" (which means "don't run Integration tests"). My Nant script successfully runs when I run it from the command line, but when Cruise runs it, the "!Integration" directive is being garbled -- the Cruise output suggests its inserting a line break after the '!' character. The result is that all my tests run, including integration tests.

Extract from ccnet.config:

<tasks>
  <nant>
    <executable>C:\nant\bin\nant.exe</executable>
    <baseDirectory>C:\MyProject\BuildDirectory</baseDirectory>
    <buildFile>MyProject.build</buildFile>
    <targetList>
       <target>CIServerBuild</target>  
    </targetList>
  </nant>
</tasks>

Extract from MyProject.build:

<target name="CIServerBuild">
      :
    <call target="RunUnitTests" />
</target>

<target name="RunUnitTests">
    <property name="TestCategories" value="!Integration" />
    <call target="RunMSTest"  failonerror="true"/>
</target>

<target name="RunMSTest">
    <call target="BuildListOfTestContainers"  failonerror="true"/>
    <exec program="${MSTest.exe}"
        commandline=" /category:&quot;${TestCategories}&quot; ${TestContainers} /resultsfile:${MSTest.ResultsFile} /nologo "
     />
</target>

Extract from Cruise output:

[exec] Starting 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe ( /category:"!
Integration" /testcontainer:C:\TaxWise\BuildDirectory\TaxWise\TaxWise.Data.Tests\bin\Debug\TaxWise.Data.Tests.dll /testcontainer:C:\TaxWise\BuildDirectory\TaxWise\TaxWise.Domain.Tests\bin\Debug\TaxWise.Domain.Tests.dll /testcontainer:C:\TaxWise\BuildDirectory\TaxWise\TaxWise.Infrastructure.Tests\bin\Debug\TaxWise.Infrastructure.Tests.dll /resultsfile:.\TestResults\UnitTests.trx /nologo )' 
in 'C:\TaxWise\BuildDirectory'

I have tried replacing the '!' character with

'&#33;' 

but that made no difference.

Any ideas, anyone?

like image 587
MrBlueSky Avatar asked Nov 13 '22 16:11

MrBlueSky


1 Answers

I suggest splitting the commandline attribute in the exec task into Nant arg elements.

http://nant.sourceforge.net/release/0.85/help/tasks/exec.html

You'll have more flexibility and the readability will increase.

like image 65
Adam Bruss Avatar answered Dec 27 '22 15:12

Adam Bruss