2014-09-12 66 views

回答

2
  1. 下载xunit-build-xyzw.zip从xUnit.net on CodePlex并将其解压到,例如,C:\Program Files\xUnit.net。添加这个位置PATH环境变量
    • 确保有没有尾随分号
  2. 修改您的CC.NET *.build脚本发现按照惯例组件,概述如下
    • 注意,命令行参数的语法不再有等号
  3. C:\Program Files\CruiseControl.NET\server\ccnet.config,合并由NUnit的亚军和xUnit.net亚军产生XML文件,概述如下构建完成后
    • 合并发生的无论构建状态,
    • 试运行的确认结果在构建脚本开始时从xUnit.net on GitHub删除
  4. 重启CC.NET
  5. 下载xUnitSummary.xsl,并把它在C:\Program Files (x86)\CruiseControl.NET\WebDashboard\xsl
  6. C:\Program Files\CruiseControl.NET\WebDashboard\dashboard.config,修改buildPlugins元件概述如下
  7. 重新启动IIS

附加信息: CruiseControl.Net – Server Installation at Neal's Blog


步骤2:

<project default="RunTests_xUnit"> 
    <target name="RunTests_xUnit" description="Runs the discovered xUnit.net unit tests" depends="someCompileStep"> 

     <!-- Outer loop to search through a list of different locations --> 
     <!-- Folders to be searched should listed as a semicolon deliminated list in the 'in' attribute --> 
     <foreach item="String" in="${TestAssemblyOutputPath}" delim=" ;" property="testsPath"> 
     <echo message="Searching for xUnit.net test suites in ${testsPath}" /> 

     <!-- Inner loop to search for dlls containing unit tests --> 
     <foreach item="File" property="filename"> 
      <in> 
      <items basedir="${testsPath}"> 
        <!-- see http://nant.sourceforge.net/release/0.91/help/types/fileset.html for how to include or exclude specific files or file patterns --> 

        <!-- attempt to run tests in any dlls whose name ends with UnitTestSuite.dll' --> 
        <include name="**UnitTestSuite.dll" /> 
      </items> 
      </in> 
      <do> 
      <property name="testDLLName" value="${path::get-file-name-without-extension(filename)}" /> 
      <echo message="Testing ${testDLLName} with xUnit.net" /> 

       <exec program="${xunit-console.exe}" failonerror="true" resultproperty="resultVal"> 
        <arg line="${testsPath}\${testDLLName}.dll /xml ${xUnitTestLogsFolder}${testDLLName}-xUnitResults.xml" /> 
       </exec> 
       <fail message="Failures reported in ${testDLLName}." failonerror="true" unless="${int::parse(resultVal)==0}" /> 
      </do> 
     </foreach> 
     </foreach> 
    </target> 
</project> 

步骤3:

<publishers> 
    <merge> 
     <files> 
     <file>C:\logs-location\xUnitTestLogs\*UnitTestSuite-xUnitResults.xml</file> 
     <file>C:\logs-location\TestLogs\*Tests-Results.xml</file> 
     </files> 
    </merge> 
    <xmllogger /> 
    <statistics /> 
</publishers> 

步骤5:

<buildPlugins> 
    <buildReportBuildPlugin> 
     <xslFileNames> 
     ... 
      <xslFile>xsl\xUnitSummary.xsl</xslFile> 
     </xslFileNames> 
    </buildReportBuildPlugin> 
    ... 
    <xslReportBuildPlugin description="xUnit.net Report" actionName="xUnitReport" xslFileName="xsl\xUnitSummary.xsl" /> 
    ... 
</buildPlugins>