views:

460

answers:

4

nunit tests fails when run through cc.net saying process timeout. Process has been killed All works fine when through nUNit or VS.

Also cc.net will then show the results of previous build even if the build is a clean one.

Any help plz.

A: 

The default timeout is 600 seconds. If your tests start to exceed that the build will fail with no indication. You may need to up the timeouts for your cc.net nunit task

Arnshea
<!--Use NUnit for unit testing--> <nunit path="C:\Program Files\NUnit 2.4.8\bin\nunit-console.exe" timeout="6000">This is the copy of my nunit task block in config file, Still they are failing with no reason
sam
I've seen nunit fail to run on tests that need to run in a Single Threaded Apartment (STA). If that's the case the -nothreaded parameter needs to be passed to nunit-console.exe...
Arnshea
Yes I am already setting the state to STA in my app.config file of VS project <NUnit> <TestRunner> <!-- Valid values are STA,MTA. WatiN requires STA. --> <add key="ApartmentState" value="STA" /> </TestRunner> </NUnit>Do you want me to set it in ccnet config file
sam
The only way I was able to get this to work was to change the nunit task to call nunit-console-no-thread.bat - a bat file that you create which calls nunit-console.exe -nothreads %*
Arnshea
+1  A: 

If you are seeing the results from a previous build, it is probably because you are not deleting the results from your previous build.

For example, my NUnit test results are written to files with the name {foo}-results.xml:

<publishers>
    <merge>
        <files>
            <file>bin\debug\*-results.xml</file>
        </files>
    </merge>
</publishers>

In my tasks, I have a step in my build file that deletes the entire "bin\debug" directory so that my results are always the current ones.

bentsai
A: 

One possibility is that you have a permission issue. CruiseControl is perhaps running under a service account and has different permissions than your user account (which I'm assuming you use to manually run the tests.) Try logging into the machine as the service account, then see if you can run the unit tests through VS or NUnit.

Pedro
A: 

I've seen this happen if a test has an assertion, e.g. Debug.Assert(something here). When this happens to me in CC.Net, the CC.Net build pops up a message box for the assertion. Since no one closes out the message box on the build server, the NUnit test times out.

Adam Tegen