2008-09-04 10 views

답변

3

나는 그것을 알아 냈다. NUnit 실행기의 경로를 TeamCity 자체의 경로로 변경합니다. 당신이 볼 수 있듯이

<mkdir dir="${build}/coverage" failonerror="false"/> 

    <!-- run the unit tests and generate code coverage --> 
    <property name="tools.dir.tmp" value="${tools.dir}"/> 
    <if test="${not path::is-path-rooted(tools.dir)}"> 
     <property name="tools.dir.tmp" value="../../${tools.dir}"/> 
    </if> 

    <property name="nunitpath" value="${lib.dir}/${lib.nunit.basedir}/bin/nunit-console.exe"/> 
    <property name="nunitargs" value=""/> 
    <if test="${property::exists('teamcity.dotnet.nunitlauncher')}"> 
     <property name="nunitpath" value="${teamcity.dotnet.nunitlauncher}"/> 
     <property name="nunitargs" value="v2.0 x86 NUnit-2.4.8"/> 
    </if> 

    <ncover program="${tools.dir.tmp}/${tools.ncover.basedir}/ncover.console.exe" 
     commandLineExe="${nunitpath}" 
     commandLineArgs="${nunitargs} ${proj.name.unix}.dll" 
     workingDirectory="${build}" 
     assemblyList="${proj.srcproj.name.unix}" 
     logFile="${build}/coverage/coverage.log" 
     excludeAttributes="System.CodeDom.Compiler.GeneratedCodeAttribute" 
     typeExclusionPatterns=".*?\{.*?\}.*?" 
     methodExclusionPatterns="get_.*?; set_.*?" 
     coverageFile="${build}/coverage/coverage.xml" 
     coverageHtmlDirectory="${build}/coverage/html/" 
    /> 

, 내가 거기에 내 자신의 일부 변수가 있지만, 당신은 무슨 일이 일어나고 있는지 알아낼 수있을 것입니다 : 다음은 그 예이다. 관심있는 속성은 teamcity.dotnet.nunitlauncher입니다. 자세한 내용은 http://www.jetbrains.net/confluence/display/TCD4/TeamCity+NUnit+Test+Launcher에서 확인할 수 있습니다.

2

NCover에서 NUnit을 실행하지 않는 이유는 무엇입니까? 당신은 똑같은 테스트 결과를 얻습니다. 또한, NCover를 테스트 외부에서 실행할 때 정확하게 측정하려는 것은 무엇입니까? 낡은 코드 또는 참조되지 않은 코드를 찾는 다른 방법이 있습니다.

0

동일한 일을해야합니다. Teamcity와 함께 제공되는 NUnit jar 파일을 열고 NUnit2와 NCover를 통합하는 사용자 정의 작업을 작성하는 것이 최선의 선택이라고 생각합니다. 이것이 그렇게 좋지는 않았지만, NUnit2 작업은 가시적 인 출력을 생성하지 않으므로 TeamCity는 분명히 테스트 결과에 대해 StdOut을 읽지 않습니다.