简体   繁体   English

TeamCity如何知道运行xUnit.net测试的时间?

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

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. 我一直想知道TeamCity如何识别它正在运行xUnit.net测试,以及它如何知道在构建步骤运行后在构建概述中添加单独的“测试”选项卡。 Is the xUnit console runner somehow responsible for that? xUnit控制台运行器是否以某种方式对此负责?

Found finally what is actually going on. 终于找到了实际发生的事情。 TeamCity has its own API. TeamCity有自己的API。 I dug this code snippet out of the xUnit source code and it becomes clear: 我从xUnit源代码中挖出了这段代码片段,它变得清晰:

https://github.com/xunit/xunit/blob/v1/src/xunit.console/RunnerCallbacks/TeamCityRunnerCallback.cs 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 ...为清楚起见省略了代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM