我有一個調用mstest的構建工作流程(xaml)。我的期望是會有一個鏈接到構建摘要頁面上的測試結果。然而,這種情況並非如此。如何從TFS構建頁面提供mstest結果?
構建以MSTest命令結束 - 由於出現故障而退出1。所以,MSTest是工作流程中的最後一項活動。
這裏肯定有些問題。放置位置僅包含工作流程日誌 - 沒有測試結果。這些可在TestResults文件夾中找到,但不在放置位置。
所以,我的問題是 - 我該如何連線MSTest活動,以便在最後會有一個鏈接到測試結果的某處?
現在的血淋淋的細節。這就是工作流程最後時刻在活動日誌中的樣子(爲簡潔起見,我用替換了一些東西)。最後注意以下消息:
Publishing results of test run [email protected] 2017-03-02 16:03:43_Any CPU_Release to http://tfsserver:8080/tfs/defaultcollection...
................Publish completed successfully.
但是它在哪裏發佈?
MSTest
Inputs
TestLists:
ToolPath:
TestNames:
MinPriority: -1
TestSettings:
CommandLineArguments:
SearchPathRoot: d:\b\test\3269\..\2282\Binaries
Platform: Any CPU
MaxPriority: -1
Category:
RunTitle:
PathToResultsFilesRoot: d:\b\test\3269\..\2282\TestResults
TestContainers: System.Linq.Enumerable+WhereEnumerableIterator`1[System.String]
TestMetadata:
TestConfigName:
Flavor: Release
TestConfigId: -1
Publish: True
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe /nologo /usestderr /searchpathroot:"d:\b\test\3269\..\2282\Binaries" /resultsfileroot:"d:\b\test\3269\..\2282\TestResults" /testcontainer:"d:\b\test\2282\Binaries\BackgroundJobTests.dll" [...] /publish:"http://tfsserver:8080/tfs/defaultcollection" /noprompt /publishbuild:"vstfs:///Build/Build/265747" /teamproject:"DFDev" /platform:"Any CPU" /flavor:"Release"
Loading d:\b\test\2282\Binaries\BackgroundJobTests.dll...
[...]
Starting execution...
Warning: The disabled test 'GetJobReqModels' was removed from the test run.
Results Top Level Tests
------- ---------------
Passed BackgroundJobTests.AsyncParallelSqlRunnerTest.AsyncExceptionInDoIt
[...]
Passed WFMCommonTest.TimesheetApi.UnitTests.TimeSegmentApiTests.Test_RoundTimeOfOneSegment
1778/5035 test(s) Passed, 3224 Failed, 33 Error
Summary
-------
Passed 1778
Failed 3224
Error 33
------------
Total 5035
Results file: d:\b\test\2282\TestResults\tfsbuild_TORSVARCH01 2017-03-02 16_03_43_Any CPU_Release.trx
Test Settings: Default Test Settings
Test Run Error.
Run has the following issue(s):
Warning: Test Run deployment issue: The assembly or module 'dtSearchNetApi2' directly or indirectly referenced by the test container 'd:\b\test\2282\binaries\ruleenginetests.dll' was not found.
[...]
Warning: Test Run deployment issue: The assembly or module 'System.ServiceModel.Web' directly or indirectly referenced by the test container 'd:\b\test\2282\binaries\utilitytest.dll' was not found.
One of the background threads threw exception:
System.Data.OleDb.OleDbException (0x80004005): Cannot open database "851qa89" requested by the login. The login failed.
[...]
One of the background threads threw exception:
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
[...]
Waiting to publish...
Publishing results of test run [email protected] 2017-03-02 16:03:43_Any CPU_Release to http://tfsserver:8080/tfs/defaultcollection...
................Publish completed successfully.
Exception Message: MSTest.exe returned an exit code of 1 indicating that not all tests passed. (type TestFailureException) Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities
編輯1
我們使用TFS 2015年構建模板是一個自定義的。
的MSTEST命令行參數可從前述的樣品中觀察到,但在這裏它們被再次破碎爲方便起見,每行一個:
/nologo
/usestderr
/searchpathroot:"d:\b\test\3269\..\2282\Binaries"
/resultsfileroot:"d:\b\test\3269\..\2282\TestResults"
/testcontainer:"d:\b\test\2282\Binaries\BackgroundJobTests.dll" ...
/publish:"http://tfsserver:8080/tfs/defaultcollection"
/noprompt
/publishbuild:"vstfs:///Build/Build/265747"
/teamproject:"DFDev"
/platform:"Any CPU"
/flavor:"Release"
的d:\b\test\2282\TestResults
夾確實包含TRX文件和輔助目錄。但這還不夠好 - 我想看起來他們在線。 mstest聲稱它們已發佈:
Publishing results of test run [email protected] 2017-03-02 16:03:43_Any CPU_Release to http://tfsserver:8080/tfs/defaultcollection...
................Publish completed successfully.
但是什麼是地址?
EDIT 2
我檢查構建的在線摘要頁面和檢測結果的鏈接是存在的,但它不是一個可以在Visual Studio中查看摘要頁面上找到。
請遵守頁面,我可以在Visual Studio 2015年看到:
現在,當通過瀏覽器訪問同一頁面。注意超鏈接到頁面右側的測試:
所以,我想我的問題可以縮小到如何能夠在Visual Studio中的生成摘要頁面上看到這個鏈接?
編輯3
這裏是我的幾乎整個構建流程 - http://pastebin.com/9z2UE79E
爲了節省一些空間,我刪除了兩個部分:
- 的InvokeProcess活動升級數據庫
- InvokeProcess活動修改某個配置文件。
我不明白我需要做什麼才能在總結頁面中包含測試摘要。
您正在使用哪個版本的TFS?你是如何定製構建過程模板的? –
給匿名downvoter - 謹慎提供理由? – mark