Build is failing to run tests on multiple libraries

We are running tests via “dotnet test”, and our TeamCity builds haven't been running all of our tests. This changed recently, and I don't see any TC setting changes nor code changes that would impact this. We are able to re-run the same build and sometimes have it succeed, so it seems somewhat random. (We have two test agents on separate servers, but that doesn't seem to be a factor either.)

Here's a successful log:

[08:09:21] :         [dotnet test] Total tests: 601

[08:09:21] :         [dotnet test]      Passed: 574

[08:09:21] :         [dotnet test]      Failed: 3

[08:09:21] :         [dotnet test]     Skipped: 24

[08:09:21]W:         [dotnet test] Test Run Failed.

[08:09:21] :         [dotnet test]  Total time: 12.6113 Minutes

[08:09:21]W:         [dotnet test] Process exited with code 1

[08:09:21]W:     [Step 1/2] Process finished with positive exit code 1 (some tests have failed). Reporting step success as all the tests have run.

[08:09:21]E:     [Step 1/2] dotnet test (53m:37s)

And here's a failed version:

[08:28:40] :         [dotnet test] Total tests: 601

[08:28:40] :         [dotnet test]      Passed: 575

[08:28:40] :         [dotnet test]      Failed: 2

[08:28:40] :         [dotnet test]     Skipped: 24

[08:28:40]W:         [dotnet test] Test Run Failed.

[08:28:40] :         [dotnet test]  Total time: 11.9931 Minutes

[08:28:40]W:         [dotnet test] Process exited with code 1

[08:28:40]E:     [Step 1/2] Process exited with code 1 (Step: NUnit Tests (.NET))

[08:28:40] :     [Step 1/2] Waiting for 6 service processes to complete

 

Both times it exited with code 1, but in one case it was a warning and it started tests on the next library, but in the failed case it was an error and aborted further test runs.

0
4 comments
Hi,

Could you please share some additional details so we can investigate this issue further?

1. TeamCity Server Version

2. Build Logs

The full build log from a successful build
The full build log from a failed build

3. Build Step Configuration

A screenshot or description of the build steps, especially the step running dotnet test
Please also indicate which runner is used for this step (e.g., .NET, Command Line, or NUnit)

These details should help us better understand the environment and identify what might be causing the inconsistent behavior.

Files can be uploaded via https://uploads.jetbrains.com/. Please let us know the exact id after the upload.





0

I was able to get back to this and I found the issue.  We had one library that had a failing test. That failing test was writing a massive amount of data to the logs, via an assert. For some reason this caused issues between dotnet test and teamcity, causing it to abort further tests, and also not report that test as failed.

I stopped the test from outputting so much data, and fixed the test and now the build is succeeding.

Not sure if this is a bug in team city, dotnet test or a test adapter.

0
Hi Dave,

I’m glad to hear that the issue has been resolved.

If possible, could you please share a sample project or demo code with us so that we can investigate this further?

In the meantime, could you also provide your TeamCity server version? 

Files can be uploaded via https://uploads.jetbrains.com/. Please let us know the exact id after the upload.
0

We are using 

TeamCity Professional 2025.11.3

Build 208117

I'm not sure if I'd be able to replicate this in demo (or not sure if I have time). The bug was a test that was calling:

Assert.AreEqual(expected, actual, messageSb.ToString());

where messageSb was about 45 MB of text.

 

0

Please sign in to leave a comment.