Domanda

I've configured Jenkins to run nunit-console as described here: Execute NUnit with Jenkins and here: How do you run NUnit tests from Jenkins?

I've added "Execute batch command" as a build step and entered the following values:

%nunit-console% .\BBA\Sources\Projects\BbaUnitTests\bin\BbaUnitTests.dll /xml=.\BBA\Sources\BuildResults\nunit-result.xml /timeout=10000

Everytime I run a build, everything works ok until it gets to this build step, this line shows up and it runs indefinitely and no xml file is generated:

C:\BuildServerFiles\workspace\BBA-71>.\BBA\Sources\Projects\RngUnitTests\bin\BbaUnitTests.dll /xml=.\BBA\Sources\BuildResults\nunit-result.xml /timeout=10000

However, when I execute:

nunit-console .\BBA\Sources\Projects\BbaUnitTests\bin\BbaUnitTests.dll /xml=.\BBA\Sources\BuildResults\nunit-result.xml /timeout=10000

from command prompt it works ok, the xml file gets generated ok. What could be the possible issue here?

È stato utile?

Soluzione

I've added this line to nant build script instead of adding a step to jenkins:

formatter type="Xml" outputdir="${main-directory}\BuildResults\" usefile="true" extension=".xml"/>

Making it this:

<target name="build" description="Build Solution and run tests">
        <echo message="Building the release configuration" />
        <exec program="${msbuild}" commandline='"${my-solution}" /v:m /nologo /property:WarningLevel=0 /t:Rebuild /p:Configuration="Release" /p:Platform="Any CPU"' />
        <echo message="Running unit tests" />
        <nunit2>
            <formatter type="Plain" />
            <formatter type="Xml" outputdir="${main-directory}\BuildResults\" usefile="true" extension=".xml"/>
            <test assemblyname="${main-directory}\Projects\MyUnitTests\bin\MyUnitTests.dll">
            </test>
        </nunit2>
    </target>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top