TFS 2017我如何知道正在运行哪个测试(在它完成之前)?

时间:2017-08-31 12:06:38

标签: tfs

我有一个TFS 2017(版本15.105.25910.0)版本,它也运行测试,但是一个测试需要很长时间,并且由于构建编辑的“常规”选项卡中设置了超时而导致整个构建被取消页。 TFS日志包含在下面。 如何查看哪个测试有问题?

注意第一个和第二个日志之间的时差。我假设在ReportAnalyzer_Blabla_SomethingTest之后运行了错误的测试,但是超过1k的测试很难猜测它是什么。

2017-08-30T11:30:09.7614471Z Passed ReportAnalyzer_Blabla_SomethingTest 2017-08-30T11:53:52.1581687Z ##[debug]FindFiles.FindMatchingFiles(rootFolder = D:\TfsBuildAgents\RmsBuild\_work\8\s\TestResults, matchPattern = *.trx, includeFiles = True, includeFolders = False 2017-08-30T11:53:52.1581687Z ##[debug]FindFiles.GetMatchingItems(includePatterns.Count = 1, excludePatterns.Count = 0, includeFiles = True, includeFolders = False 2017-08-30T11:53:52.1581687Z ##[debug]FindFiles.FindMatchingFiles - Found 0 matches 2017-08-30T11:53:52.1581687Z ##[debug]Processed: ##vso[task.logissue type=warning;code=002003;] 2017-08-30T11:53:52.1581687Z 2017-08-30T11:53:52.1581687Z 2017-08-30T11:53:52.1737949Z ##[warning]No results found to publish. 2017-08-30T11:53:52.1737949Z ##[debug]Processed: ##vso[task.logissue type=warning]No results found to publish. 2017-08-30T11:53:52.2050485Z ##[error]The operation was canceled. 2017-08-30T11:53:52.2050485Z ##[debug]System.OperationCanceledException: The operation was canceled.

2 个答案:

答案 0 :(得分:1)

通常,错误测试应该是ReportAnalyzer_Blabla_SomethingTest之后的第一次测试。但是正如你所说,它有超过1k的测试,根据你发布的日志,如果你没有拆分测试我们无法准确地确定哪个测试是错误的。在这种情况下,我担心你必须逐个调试。

所以,哟可以尝试拆分测试,然后相应地调试它们。

您还可以尝试检查是否有任何其他详细日志来跟踪它。 有关详细信息,请参阅Review continuous test results after a build

答案 1 :(得分:0)

我发现了一个凌乱的解决方法,帮助我找到了失败的测试。在所有测试类(凌乱的部分)中,我添加了一个代码,将当前运行的单元测试名称附加到文件中 - 最后一个条目是我感兴趣的。

conf.py

“在整个测试项目中每次测试之前运行代码”的关闭似乎是 [ClassInitialize] public static void ClassInitialzie(TestContext testContext) { // This is just an example! File.AppendAllText("testRunLog.txt", testContext.TestName + Environment.NewLine); } 属性。 https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.classinitializeattribute.aspx