开发者

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 开发者_StackOverflow社区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?


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.


Yes, perhaps it is not caused by CC. Try setting verbose="True" on the <exec> task and check the raw build protocol. Remember what you see on the report page is not the exact output (typically subject to line-wrap and coalescing whitespaces).

Maybe it depends on from where you run the script, a hidden dependency on a build property or different environment variables. You can check the latter using <exec program="cmd.exe" commandline="/c set" />. For the properties you can use the following script:

 <script language="C#" prefix="util" verbose="true">
    <code>
        <![CDATA[
        public static void ScriptMain(Project project) 
        {
            foreach (DictionaryEntry entry in new System.Collections.SortedList(project.Properties) ) 
                Console.WriteLine("{0}={1}", entry.Key, entry.Value); 
        }
        ]]>
    </code>
  </script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜