Ncover with nunit2 task in NAnt

Is there a chance to get this job? I want my tests to be run using the nunit2 task in NAnt. In addition, I want to run NCover without retesting.

+3
source share
3 answers

I get it. You change the path of the NUnit launcher to the type TeamCity. Here is an example:

    <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/"
    />

As you can see, I have some of my own variables, but you should be able to figure out what is going on. The property you are talking about is teamcity.dotnet.nunitlauncher. You can read about it here at http://www.jetbrains.net/confluence/display/TCD4/TeamCity+NUnit+Test+Launcher .

+3
source

NCover NUnit? . , NCover ? .

+2

I need to do the same. I think the best we can hope for is to open the NUnit jar file that comes with TeamCity and write a custom task that integrates NUnit2 and NCover. I would like this to be different, but the NUnit2 task does not produce visible results, so TeamCity does not explicitly read StdOut for the test results.

0
source

Source: https://habr.com/ru/post/1696679/


All Articles