How does TeamCity know when an xUnit.net test is run?

722 Views Asked by At

I have always wondered how TeamCity recognizes that it is running xUnit.net tests and how it knows to put a separate "Test" tab in the build overview after a build step runs. Is the xUnit console runner somehow responsible for that?

1

There are 1 best solutions below

0
user576700 On BEST ANSWER

Found finally what is actually going on. TeamCity has its own API. I dug this code snippet out of the xUnit source code and it becomes clear:

https://github.com/xunit/xunit/blob/v1/src/xunit.console/RunnerCallbacks/TeamCityRunnerCallback.cs

 public override void AssemblyStart(TestAssembly testAssembly)
    {
        Console.WriteLine(
            "##teamcity[testSuiteStarted name='{0}']",
            Escape(Path.GetFileName(testAssembly.AssemblyFilename))
        );
    }

...code omitted for clarity