2014-09-12 63 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>