2017-08-31 87 views
1

我有一個TFS 2017(版本15.105.25910.0)構建,它也運行測試,但是一個測試需要很長時間,並且由於在構建編輯頁面的'常規'選項卡中設置了超時,整個構建將被取消。 TFS日誌包含在下面。 如何檢查哪個測試有問題?TFS 2017我如何知道哪些測試正在運行(在完成之前)?

注意第一個和第二個日誌之間的時間差。我假設一個錯誤的測試正在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.

+0

您使用哪個任務來運行測試? –

回答

0

我發現了一個混亂的解決方法,幫助我找到了失敗的測試。在所有測試類(凌亂的部分),我已經添加了附加當前運行單元測試名文件的代碼 - 中的最後一項是我感興趣的是

[ClassInitialize] 
    public static void ClassInitialzie(TestContext testContext) 
    { 
     // This is just an example! 
     File.AppendAllText("testRunLog.txt", testContext.TestName + Environment.NewLine); 
    } 

該關閉的事情。 「在整個測試項目的每次測試之前運行代碼」似乎是ClassInitialize屬性。 https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.classinitializeattribute.aspx

1

通常有故障的測試應該ReportAnalyzer_Blabla_SomethingTest後是第一測試。但正如你所說,根據你公佈的日誌,它有超過1K的測試,如果你沒有分割測試,我們不能準確識別哪個測試是錯誤的。在這種情況下,恐怕你必須逐個調試。

所以,你可以嘗試拆分測試,然後相應地進行調試。

您還可以嘗試檢查是否有任何其他詳細日誌來跟蹤該日誌。 有關更多信息,請參閱Review continuous test results after a build

+0

謝謝你的回覆。如果運行被取消,恐怕沒有測試結果可供瀏覽。 '## [警告]沒有發現結果發佈。「另外在本地進行逐個調試有時會產生與在TFS上運行不同的結果(有些測試非常老舊和混亂)。 – user1713059

相關問題