VSTS构建:运行测试,但测试失败,报告为失败,并显示“ Vstest失败,并显示错误。检查日志以了解失败。可能有失败的测试。”

时间:2018-08-28 00:25:02

标签: .net-core azure-devops mstest azure-pipelines

我需要VSTS托管版本的帮助。

在托管的VSTS构建上,运行测试任务将运行测试,但是尽管测试实际在运行,但仍被标记为失败。

相关行是:

  

System.IO.FileNotFoundException:无法找到测试   D:\ a \ 1 \ s \ src \ XXX.YYY.IntegrationTests \ obj \ Release \ netcoreapp2.1 \ XXX.YYY.IntegrationTests.dll。   确保测试项目具有包的nuget参考   “ Microsoft.NET.Test.Sdk”和框架版本设置为   适当。使用/ diag选项重新运行以进一步诊断。 (... 更多   此处,请参见下文)[警告] Vstest失败,并显示错误。检查日志   对于失败。可能测试失败。 [错误]错误:C:\ Program   文件(x86)\ Microsoft Visual   Studio \ 2017 \ Enterprise \ Common7 \ IDE \ CommonExtensions \ Microsoft \ TestWindow \ vstest.console.exe   失败,返回码:1

所有测试项目都引用了Microsoft.NET.Test.Sdk 15.8.0。 MSTest.TestAdapter和MSTest.TestFramework均为v1.3.2。


更新

如果我在本地运行"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "path/to/dlls/X.Tests.dll"

我知道

  

Warning: No test is available in (...). Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.

如果我运行"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\Extensions\TestPlatform\vstest.console.exe",则不会发出警告,也不会运行测试。

完整日志:

2018-08-28T00:00:45.6647912Z ##[section]Starting: Run Tests (without
IntegrationTests) 2018-08-28T00:00:45.6655596Z
============================================================================== 2018-08-28T00:00:45.6655734Z Task         : Visual Studio Test
2018-08-28T00:00:45.6655969Z Description  : Run unit and functional
tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio
Test (VsTest) runner. Test frameworks that have a Visual Studio test
adapter such as MsTest, xUnit, NUnit, Chutzpah (for JavaScript tests
using QUnit, Mocha and Jasmine), etc. can be run. Tests can be
distributed on multiple agents using this task (version 2).
2018-08-28T00:00:45.6656222Z Version      : 2.139.9
2018-08-28T00:00:45.6656325Z Author       : Microsoft Corporation
2018-08-28T00:00:45.6656441Z Help         : [More
Information](https://go.microsoft.com/fwlink/?LinkId=835764)
2018-08-28T00:00:45.6656579Z
==============================================================================2018-08-28T00:00:46.4686294Z SystemVssConnection exists true
2018-08-28T00:00:46.8053935Z SystemVssConnection exists true
2018-08-28T00:00:46.8765427Z Running tests using vstest.console.exe
runner. 2018-08-28T00:00:46.8765592Z
====================================================== 2018-08-28T00:00:46.8766130Z Test selector : Test assemblies
2018-08-28T00:00:46.8766339Z Test filter criteria :
TestCategory!=Nightly&TestCategory!=Integration
2018-08-28T00:00:46.8766639Z Search folder : D:\a\1\s
2018-08-28T00:00:46.8767889Z VisualStudio version selected for test
execution : latest 2018-08-28T00:00:46.9774487Z Run settings file :
undefined 2018-08-28T00:00:46.9856390Z Run in parallel : true
2018-08-28T00:00:46.9857604Z Run in isolation : false
2018-08-28T00:00:46.9858323Z Path to custom adapters : null
2018-08-28T00:00:46.9859693Z Other console options : null
2018-08-28T00:00:46.9860021Z Code coverage enabled : true
2018-08-28T00:00:46.9860217Z Diagnostics enabled : false
2018-08-28T00:00:46.9868731Z SystemVssConnection exists true
2018-08-28T00:00:46.9871063Z Run the tests locally using
vstest.console.exe 2018-08-28T00:00:46.9871397Z
======================================================== 2018-08-28T00:00:46.9871825Z Test selector : Test assemblies
2018-08-28T00:00:46.9879358Z Test assemblies :
**\XXX.*Test.dll,**\XXX.*Tests.dll 2018-08-28T00:00:46.9879772Z Test filter criteria : TestCategory!=Nightly&TestCategory!=Integration
2018-08-28T00:00:46.9880123Z Search folder : D:\a\1\s
2018-08-28T00:00:46.9880462Z Run settings file : D:\a\1\s
2018-08-28T00:00:46.9880914Z Run in parallel : true
2018-08-28T00:00:46.9881241Z Run in isolation : false
2018-08-28T00:00:46.9896387Z Path to custom adapters : null
2018-08-28T00:00:46.9898274Z Other console options : null
2018-08-28T00:00:46.9898473Z Code coverage enabled : true
2018-08-28T00:00:46.9898590Z Diagnostics enabled : false
2018-08-28T00:00:46.9898960Z Rerun failed tests: false
2018-08-28T00:00:46.9899597Z VisualStudio version selected for test
execution : latest 2018-08-28T00:00:47.8284246Z
======================================================== 2018-08-28T00:00:52.8242247Z
====================================================== 2018-08-28T00:00:57.9400998Z [command]"C:\Program Files
(x86)\Microsoft Visual
Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"
@D:\a\_temp\6aed9fa1-aa55-11e8-bb9b-4d643c49ae03.txt
2018-08-28T00:01:00.8269632Z Microsoft (R) Test Execution Command Line
Tool Version 15.8.0 2018-08-28T00:01:00.8270417Z Copyright (c)
Microsoft Corporation.  All rights reserved.
2018-08-28T00:01:00.8270820Z  2018-08-28T00:01:00.8632494Z
vstest.console.exe  2018-08-28T00:01:00.8633358Z
"D:\a\1\s\src\XXX.YYY.IntegrationTests\bin\Release\netcoreapp2.1\XXX.YYY.IntegrationTests.dll"
2018-08-28T00:01:00.8633627Z
"D:\a\1\s\src\XXX.YYY.IntegrationTests\obj\Release\netcoreapp2.1\XXX.YYY.IntegrationTests.dll"
2018-08-28T00:01:00.8633953Z
"D:\a\1\s\src\XXX.YYY.ZZZ.IntegrationTests\bin\Release\netcoreapp2.1\XXX.YYY.IntegrationTests.dll"
2018-08-28T00:01:00.8636191Z
"D:\a\1\s\src\XXX.YYY.ZZZ.IntegrationTests\bin\Release\netcoreapp2.1\XXX.YYY.ZZZ.IntegrationTests.dll"
2018-08-28T00:01:00.8636472Z
"D:\a\1\s\src\XXX.YYY.ZZZ.IntegrationTests\obj\Release\netcoreapp2.1\XXX.YYY.ZZZ.IntegrationTests.dll"
2018-08-28T00:01:00.8636787Z
"D:\a\1\s\src\XXX.YYY.ZZZ.Tests\bin\Release\netcoreapp2.1\XXX.YYY.ZZZ.Tests.dll"
2018-08-28T00:01:00.8637041Z
"D:\a\1\s\src\XXX.YYY.ZZZ.Tests\obj\Release\netcoreapp2.1\XXX.YYY.ZZZ.Tests.dll"
2018-08-28T00:01:00.8637315Z
/TestCaseFilter:"TestCategory!=Nightly&TestCategory!=Integration"
2018-08-28T00:01:00.8637743Z
/Settings:"D:\a\_temp\6df3dac0-aa55-11e8-bb9b-4d643c49ae03.runsettings"
2018-08-28T00:01:00.8637935Z /EnableCodeCoverage
2018-08-28T00:01:00.8638256Z /logger:"trx"
2018-08-28T00:01:00.8638548Z /TestAdapterPath:"D:\a\1\s"
2018-08-28T00:01:03.1903254Z Starting test execution, please wait...
2018-08-28T00:01:08.9432858Z M i c r o s o f t   ( R )   C o v e r a g
e   C o l l e c t i o n   T o o l   V e r s i o n   1 5 . 0 . 3 0 3 1
9 . 0  2018-08-28T00:01:08.9433639Z   2018-08-28T00:01:08.9433873Z  
2018-08-28T00:01:08.9434477Z  C o p y r i g h t   ( c )   M i c r o s
o f t   C o r p o r a t i o n .     A l l   r i g h t s   r e s e r v
e d .  2018-08-28T00:01:08.9435073Z   2018-08-28T00:01:08.9435257Z  
2018-08-28T00:01:08.9435441Z   2018-08-28T00:01:08.9435606Z  
2018-08-28T00:01:08.9436502Z  M i c r o s o f t   ( R )   C o v e r a
g e   C o l l e c t i o n   T o o l   V e r s i o n   1 5 . 0 . 3 0 3
1 9 . 0  2018-08-28T00:01:08.9437228Z   2018-08-28T00:01:08.9437526Z  
2018-08-28T00:01:08.9438317Z  C o p y r i g h t   ( c )   M i c r o s
o f t   C o r p o r a t i o n .     A l l   r i g h t s   r e s e r v
e d .  2018-08-28T00:01:08.9443745Z   2018-08-28T00:01:08.9444075Z  
2018-08-28T00:01:08.9444447Z   2018-08-28T00:01:08.9445013Z  
2018-08-28T00:01:09.1360861Z  2.3895 2018-08-28T00:01:09.1382638Z
3.2133 2018-08-28T00:01:09.2952622Z System.IO.FileNotFoundException: Unable to find tests for
D:\a\1\s\src\XXX.YYY.IntegrationTests\obj\Release\netcoreapp2.1\XXX.YYY.IntegrationTests.dll.
Make sure test project has a nuget reference of package
"Microsoft.NET.Test.Sdk" and framework version settings are
appropriate. Rerun with /diag option to diagnose further.
2018-08-28T00:01:09.2953540Z    at
Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostProcessStartInfo(IEnumerable`1
sources, IDictionary`2 environmentVariables, TestRunnerConnectionInfo
connectionInfo) 2018-08-28T00:01:09.2953958Z    at
Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1
sources) 2018-08-28T00:01:09.2954380Z    at
Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyExecutionManager.StartTestRun(TestRunCriteria
testRunCriteria, ITestRunEventsHandler eventHandler) ...(more of
'Unable to find tests' here) 2018-08-28T00:01:17.0497760Z  
2018-08-28T00:01:17.0497920Z   2018-08-28T00:01:17.0498091Z  
2018-08-28T00:01:18.7123301Z  Passed   Test1
2018-08-28T00:01:18.7123882Z Passed   Test1 (1.2.3.4,1002003004)
2018-08-28T00:01:18.7124151Z Passed   Test1 (1.5.14.0,1005014000)
...(more passed tests here) 2018-08-28T00:01:19.3916949Z M i c r o s o
f t   ( R )   C o v e r a g e   C o l l e c t i o n   T o o l   V e r
s i o n   1 5 . 0 . 3 0 3 1 9 . 0  2018-08-28T00:01:19.3918731Z  
2018-08-28T00:01:19.3919724Z   2018-08-28T00:01:19.3920819Z  C o p y r
i g h t   ( c )   M i c r o s o f t   C o r p o r a t i o n .     A l
l   r i g h t s   r e s e r v e d .  2018-08-28T00:01:19.3921474Z  
2018-08-28T00:01:19.3921706Z   2018-08-28T00:01:19.3921874Z  
2018-08-28T00:01:19.3922056Z   2018-08-28T00:01:19.4835444Z  Passed  
TestRossWorkingSetTrigger (50,True,0,False)
2018-08-28T00:01:19.4836131Z Passed   TestRossWorkingSetTrigger
(50,True,100,True) 2018-08-28T00:01:21.1779354Z Results File:
D:\a\1\s\TestResults\VssAdministrator_factoryvm-az43_2018-08-28_00_01_18.trx
2018-08-28T00:01:21.1798304Z  2018-08-28T00:01:21.1801010Z
Attachments: 2018-08-28T00:01:21.1801324Z  
D:\a\1\s\TestResults\f1fe44c3-72d3-48e7-ba2f-99587f547b22\VssAdministrator_factoryvm-az43
2018-08-28 00_01_08.coverage 2018-08-28T00:01:21.1801492Z 
2018-08-28T00:01:21.1803157Z Total tests: Unknown. Passed: 76. Failed:
0. Skipped: 0. 2018-08-28T00:01:21.1805289Z Test Run Aborted. 2018-08-28T00:01:21.1814377Z Test execution time: 11.8839 Seconds
2018-08-28T00:01:21.2073077Z ##[warning]Vstest failed with error.
Check logs for failures. There might be failed tests.
2018-08-28T00:01:21.2456354Z ##[error]Error: C:\Program Files
(x86)\Microsoft Visual
Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe
failed with return code: 1 2018-08-28T00:01:21.7575618Z
##[error]VsTest task failed. 2018-08-28T00:01:21.8006819Z ##[section]Async Command Start: Publish test results 2018-08-28T00:01:21.8288090Z Publishing test results to test run
'14831' 2018-08-28T00:01:21.8288284Z Test results remaining: 16. Test
run id: 14831 2018-08-28T00:01:22.9116908Z Published Test Run :
https://rbtech.visualstudio.com/XXX/_TestManagement/Runs#runId=14831&_a=runCharts
2018-08-28T00:01:22.9117351Z ##[section]Async Command End: Publish
test results 2018-08-28T00:01:22.9118586Z ##[section]Finishing: Run
Tests (without IntegrationTests)

预先感谢您的帮助。

0 个答案:

没有答案