notes from a passionate developer





This is a personal blog. The opinions expressed here represent my own and not those of my employer, nor current or previous. All content is published "as is", without warranty of any kind and I don't take any responsibility and can't be liable for any claims, damages or other liabilities that might be caused by the content.

Getting test results from dotnet test to show in TeamCity

I'm a happy user of CakeBuild and TeamCity. I'm a firm believer of build scripts versus configuring the actual build server with a bunch of steps. I've been having one problem though. Test results from e.g. xUnit and MSTests wasn't being picked up by TeamCity anymore. Apparently there was a change in the output of the test runner for .NET Core. But there's a quick solution. In my Cake build script, I just needed to add one little line:

Logger = "console;verbosity=normal"

You can see a sample of a real change to Ensure.That's build.cake file My step to run the unit tests looks like this:

Task("UnitTests").Does(() => {
    var settings = new DotNetCoreTestSettings {
        Configuration = config.BuildProfile,
        NoBuild = true,
        Logger = "console;verbosity=normal"
    foreach(var testProj in GetFiles($"{config.SrcDir}tests/**/UnitTests.csproj")) {
        DotNetCoreTest(testProj.FullPath, settings);

Result? Before and after build:


I've seen some suggestions to use Verbosity = DotNetCoreVerbosity.Detailed, but that didn't work for me.

Thats all for this time, I'll try and pick up the blogging again.


View Comments