测试程序集从命令提示符运行,但不是从发布管道运行,“找不到与模式匹配的测试程序集”错误

时间:2019-07-16 19:52:49

标签: c# automated-tests integration-testing azure-pipelines tfs2017

最近一次运行的日志;进行精简以保持简洁

2019-07-18T18:27:42.9323100Z ##[section]Starting: VsTest - testAssemblies
2019-07-18T18:27:42.9323100Z Task         : Visual Studio Test
2019-07-18T18:27:42.9323100Z Description  : Run tests with Visual Studio test runner
2019-07-18T18:27:43.2448193Z ##[debug]agent.workFolder=D:\TFSVSOWork
2019-07-18T18:27:43.5104476Z ##[debug]System.DefaultWorkingDirectory=D:\TFSVSOWork\r45\a
2019-07-18T18:27:43.6979545Z ##[debug]check path : D:\TFSVSOWork\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.0.55\task.json
2019-07-18T18:27:43.6979545Z ##[debug]set resource file to: D:\TFSVSOWork\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.0.55\task.json
2019-07-18T18:27:43.6979545Z ##[debug]system.culture=en-US
2019-07-18T18:27:43.6979545Z ##[debug]System.ParallelExecutionType=None
2019-07-18T18:27:43.6979545Z ##[debug]Value of ParallelExecutionType :None
2019-07-18T18:27:43.6979545Z ##[debug]testSelector=testAssemblies
2019-07-18T18:27:43.6979545Z ##[debug]Value of Test Selector :testAssemblies
2019-07-18T18:27:43.6979545Z ##[debug]testAssemblyVer2=XYZAppName.Nunit.UITests.dll
2019-07-18T18:27:43.6979545Z Test assemblies : XYZAppName.Nunit.UITests.dll
2019-07-18T18:27:43.6979545Z ##[debug]testFiltercriteria=null
2019-07-18T18:27:43.6979545Z Test filter criteria : null
2019-07-18T18:27:43.6979545Z ##[debug]searchFolder=\\Servername\D$\FAF_Applications\Http\XYZAppName\test
2019-07-18T18:27:43.6979545Z Search folder : \\Servername\D$\FAF_Applications\Http\XYZAppName\test
2019-07-18T18:27:43.6979545Z ##[debug]runSettingsFile=D:\TFSVSOWork\r45\a
2019-07-18T18:27:43.6979545Z Run settings file : D:\TFSVSOWork\r45\a
2019-07-18T18:27:43.6979545Z ##[debug]overrideTestrunParameters=null
2019-07-18T18:27:43.7135813Z ##[debug]runInParallel=false
2019-07-18T18:27:43.7135813Z Run in parallel : false
2019-07-18T18:27:43.7135813Z ##[debug]runTestsInIsolation=false
2019-07-18T18:27:43.7135813Z Run in isolation : false
2019-07-18T18:27:43.7135813Z ##[debug]runOnlyImpactedTests=false
2019-07-18T18:27:43.7135813Z ##[debug]wmic arg: ["datafile","where","name='C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\TestAgent\\\\Common7\\\\IDE\\\\Extensions\\\\TestPlatform\\\\vstest.console.exe'","get","Version","/Value"]
2019-07-18T18:27:43.7135813Z ##[debug]exec tool: wmic
2019-07-18T18:27:43.7135813Z ##[debug]Arguments:
2019-07-18T18:27:43.7135813Z ##[debug]   datafile
2019-07-18T18:27:43.7135813Z ##[debug]   where
2019-07-18T18:27:43.7135813Z ##[debug]   name='C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\TestAgent\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe'
2019-07-18T18:27:43.7135813Z ##[debug]   get
2019-07-18T18:27:43.7135813Z ##[debug]   Version
2019-07-18T18:27:43.7135813Z ##[debug]   /Value
2019-07-18T18:27:43.7135813Z [command]wmic datafile where "name='C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\TestAgent\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe'" get Version /Value
2019-07-18T18:27:43.8073338Z Version=15.0.0.0
2019-07-18T18:27:43.8073338Z ##[debug]VSTest Version information: 
2019-07-18T18:27:43.8073338Z Version=15.0.0.0
2019-07-18T18:27:43.8073338Z ##[debug]publishRunAttachments=true
2019-07-18T18:27:43.8073338Z ##[debug]vstest.ignoretestfailures=undefined
2019-07-18T18:27:43.8073338Z ========================================================
2019-07-18T18:27:43.8073338Z ##[debug]TestRunResults Directory : D:\TFSVSOWork\r45\a\TestResults
2019-07-18T18:27:43.8073338Z ##[debug]rm -rf D:\TFSVSOWork\r45\a\TestResults
2019-07-18T18:27:43.8073338Z ##[debug]testing directory 'D:\TFSVSOWork\r45\a\TestResults'
2019-07-18T18:27:43.8073338Z ##[debug]testing directory 'D:\TFSVSOWork\r45\a'
2019-07-18T18:27:43.8073338Z ##[debug]mkdir 'D:\TFSVSOWork\r45\a\TestResults'
2019-07-18T18:27:43.8073338Z ##[debug]Searching for test assemblies in: \\Servername\D$\FAF_Applications\Http\XYZAppName\test
2019-07-18T18:27:43.8073338Z ##[debug]defaultRoot: '\\Servername\D$\FAF_Applications\Http\XYZAppName\test'
2019-07-18T18:27:43.8073338Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
2019-07-18T18:27:43.8073338Z ##[debug]findOptions.followSymbolicLinks: 'true'
2019-07-18T18:27:43.8073338Z ##[debug]matchOptions.debug: 'false'
2019-07-18T18:27:43.8073338Z ##[debug]matchOptions.nobrace: 'true'
2019-07-18T18:27:43.8073338Z ##[debug]matchOptions.noglobstar: 'false'
2019-07-18T18:27:43.8073338Z ##[debug]matchOptions.dot: 'true'
2019-07-18T18:27:43.8073338Z ##[debug]matchOptions.noext: 'false'
2019-07-18T18:27:43.8073338Z ##[debug]matchOptions.nocase: 'true'
2019-07-18T18:27:43.8073338Z ##[debug]matchOptions.nonull: 'false'
2019-07-18T18:27:43.8073338Z ##[debug]matchOptions.matchBase: 'false'
2019-07-18T18:27:43.8073338Z ##[debug]matchOptions.nocomment: 'false'
2019-07-18T18:27:43.8073338Z ##[debug]matchOptions.nonegate: 'false'
2019-07-18T18:27:43.8073338Z ##[debug]matchOptions.flipNegate: 'false'
2019-07-18T18:27:43.8073338Z ##[debug]pattern: 'XYZAppName.Nunit.UITests.dll'
2019-07-18T18:27:43.8073338Z ##[debug]findPath: '\\Servername\D$\FAF_Applications\Http\XYZAppName\test\XYZAppName.Nunit.UITests.dll'
2019-07-18T18:27:43.8073338Z ##[debug]statOnly: 'true'
2019-07-18T18:27:43.8229587Z ##[debug]found 1 paths
2019-07-18T18:27:43.8229587Z ##[debug]applying include pattern
2019-07-18T18:27:43.8229587Z ##[debug]adjustedPattern: '\\Servername\D$\FAF_Applications\Http\XYZAppName\test\XYZAppName.Nunit.UITests.dll'
2019-07-18T18:27:43.8229587Z ##[debug]1 matches
2019-07-18T18:27:43.8229587Z ##[debug]1 final results
2019-07-18T18:27:43.8229587Z ##[debug]DisableTestImpactAnalysis=undefined
2019-07-18T18:27:43.8229587Z ##[debug]Non TIA mode of test execution
2019-07-18T18:27:43.8229587Z ##[debug]defaultRoot: '\\Servername\D$\FAF_Applications\Http\XYZAppName\test'
2019-07-18T18:27:43.8229587Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
2019-07-18T18:27:43.8229587Z ##[debug]findOptions.followSymbolicLinks: 'true'
2019-07-18T18:27:43.8229587Z ##[debug]matchOptions.debug: 'false'
2019-07-18T18:27:43.8229587Z ##[debug]matchOptions.nobrace: 'true'
2019-07-18T18:27:43.8229587Z ##[debug]matchOptions.noglobstar: 'false'
2019-07-18T18:27:43.8229587Z ##[debug]matchOptions.dot: 'true'
2019-07-18T18:27:43.8229587Z ##[debug]matchOptions.noext: 'false'
2019-07-18T18:27:43.8229587Z ##[debug]matchOptions.nocase: 'true'
2019-07-18T18:27:43.8229587Z ##[debug]matchOptions.nonull: 'false'
2019-07-18T18:27:43.8229587Z ##[debug]matchOptions.matchBase: 'false'
2019-07-18T18:27:43.8229587Z ##[debug]matchOptions.nocomment: 'false'
2019-07-18T18:27:43.8229587Z ##[debug]matchOptions.nonegate: 'false'
2019-07-18T18:27:43.8229587Z ##[debug]matchOptions.flipNegate: 'false'
2019-07-18T18:27:43.8229587Z ##[debug]pattern: '**\*TestAdapter.dll'
2019-07-18T18:27:43.8229587Z ##[debug]findPath: '\\Servername\D$\FAF_Applications\Http\XYZAppName\test'
2019-07-18T18:27:43.8229587Z ##[debug]statOnly: 'false'
2019-07-18T18:27:43.8229587Z ##[debug]findPath: '\\Servername\D$\FAF_Applications\Http\XYZAppName\test'
2019-07-18T18:27:43.8229587Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
2019-07-18T18:27:43.8229587Z ##[debug]findOptions.followSymbolicLinks: 'true'
2019-07-18T18:27:43.9167061Z ##[debug]306 results
2019-07-18T18:27:43.9167061Z ##[debug]found 306 paths
2019-07-18T18:27:43.9167061Z ##[debug]applying include pattern
2019-07-18T18:27:43.9167061Z ##[debug]adjustedPattern: '\\Servername\D$\FAF_Applications\Http\XYZAppName\test\**\*TestAdapter.dll'
2019-07-18T18:27:43.9167061Z ##[debug]1 matches
2019-07-18T18:27:43.9167061Z ##[debug]1 final results
2019-07-18T18:27:43.9167061Z ##[debug]System.Debug=true
2019-07-18T18:27:43.9167061Z ##[warning]vstest.console.exe version does not support the /diag flag. Enable diagnositics via the exe.config files
2019-07-18T18:27:43.9167061Z ##[debug]Processed: ##vso[task.issue type=warning;]vstest.console.exe version does not support the /diag flag. Enable diagnositics via the exe.config files
2019-07-18T18:27:43.9167061Z ##[debug]C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe arg: \\Servername\D$\FAF_Applications\Http\XYZAppName\test\XYZAppName.Nunit.UITests.dll
2019-07-18T18:27:43.9323329Z ##[debug]C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe arg: /logger:trx
2019-07-18T18:27:43.9323329Z ##[debug]C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe arg: /TestAdapterPath:"D:\TFSVSOWork\r45\a"
2019-07-18T18:27:43.9323329Z ##[debug]C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe arg: /framework: ".NetFramework,version=V4.7.2"
2019-07-18T18:27:43.9323329Z ##[debug]testing directory 'D:\TFSVSOWork\r45\a\TestResults'
2019-07-18T18:27:43.9323329Z ##[debug]testing directory 'D:\TFSVSOWork\r45\a'
2019-07-18T18:27:43.9323329Z ##[debug]mkdir 'D:\TFSVSOWork\r45\a\TestResults'
2019-07-18T18:27:43.9323329Z ##[debug]exec tool: C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe
2019-07-18T18:27:43.9323329Z ##[debug]Arguments:
2019-07-18T18:27:43.9323329Z ##[debug]   \\Servername\D$\FAF_Applications\Http\XYZAppName\test\XYZAppName.Nunit.UITests.dll
2019-07-18T18:27:43.9323329Z ##[debug]   /logger:trx
2019-07-18T18:27:43.9323329Z ##[debug]   /TestAdapterPath:"D:\TFSVSOWork\r45\a"
2019-07-18T18:27:43.9323329Z ##[debug]   /framework:
2019-07-18T18:27:43.9323329Z ##[debug]   .NetFramework,version=V4.7.2
2019-07-18T18:27:43.9323329Z [command]"C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" \\Servername\D$\FAF_Applications\Http\XYZAppName\test\XYZAppName.Nunit.UITests.dll /logger:trx "/TestAdapterPath:\"D:\TFSVSOWork\r45\a\"" /framework: .NetFramework,version=V4.7.2
2019-07-18T18:27:44.0417108Z Microsoft (R) Test Execution Command Line Tool Version 15.9.0
2019-07-18T18:27:44.1198351Z The /Framework argument requires the target .Net Framework version for the test run.   Example:  /Framework:".NETFramework,Version=v4.5.1"
2019-07-18T18:27:44.1198351Z The test source file "D:\TFSVSOWork\r45\a\.NetFramework,version=V4.7.2" provided was not found.
2019-07-18T18:27:44.1198351Z The test source file "D:\TFSVSOWork\r45\a\.NetFramework,version=V4.7.2" provided was not found.
2019-07-18T18:27:44.3854671Z Description: Runs tests from the specified files.
2019-07-18T18:27:44.4323429Z ##[debug]rc:1
2019-07-18T18:27:44.4323429Z ##[debug]success:false
2019-07-18T18:27:44.4323429Z ##[warning]Vstest failed with error. Check logs for failures. There might be failed tests.
2019-07-18T18:27:44.4323429Z ##[debug]Processed: ##vso[task.issue type=warning;]Vstest failed with error. Check logs for failures. There might be failed tests.
2019-07-18T18:27:44.4323429Z ##[error]Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe failed with return code: 1
2019-07-18T18:27:44.4323429Z ##[debug]Processed: ##vso[task.issue type=error;]Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe failed with return code: 1
2019-07-18T18:27:44.4323429Z ##[debug]defaultRoot: 'D:\TFSVSOWork\r45\a\TestResults'
2019-07-18T18:27:44.4323429Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
2019-07-18T18:27:44.4323429Z ##[debug]findOptions.followSymbolicLinks: 'true'
2019-07-18T18:27:44.4323429Z ##[debug]matchOptions.debug: 'false'
2019-07-18T18:27:44.4323429Z ##[debug]matchOptions.nobrace: 'true'
2019-07-18T18:27:44.4323429Z ##[debug]matchOptions.noglobstar: 'false'
2019-07-18T18:27:44.4323429Z ##[debug]matchOptions.dot: 'true'
2019-07-18T18:27:44.4323429Z ##[debug]matchOptions.noext: 'false'
2019-07-18T18:27:44.4323429Z ##[debug]matchOptions.nocase: 'true'
2019-07-18T18:27:44.4323429Z ##[debug]matchOptions.nonull: 'false'
2019-07-18T18:27:44.4323429Z ##[debug]matchOptions.matchBase: 'false'
2019-07-18T18:27:44.4323429Z ##[debug]matchOptions.nocomment: 'false'
2019-07-18T18:27:44.4323429Z ##[debug]matchOptions.nonegate: 'false'
2019-07-18T18:27:44.4323429Z ##[debug]matchOptions.flipNegate: 'false'
2019-07-18T18:27:44.4323429Z ##[debug]pattern: 'D:\TFSVSOWork\r45\a\TestResults\*.trx'
2019-07-18T18:27:44.4323429Z ##[debug]findPath: 'D:\TFSVSOWork\r45\a\TestResults'
2019-07-18T18:27:44.4323429Z ##[debug]statOnly: 'false'
2019-07-18T18:27:44.4323429Z ##[debug]findPath: 'D:\TFSVSOWork\r45\a\TestResults'
2019-07-18T18:27:44.4323429Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
2019-07-18T18:27:44.4323429Z ##[debug]findOptions.followSymbolicLinks: 'true'
2019-07-18T18:27:44.4323429Z ##[debug]  D:\TFSVSOWork\r45\a\TestResults (directory)
2019-07-18T18:27:44.4323429Z ##[debug]1 results
2019-07-18T18:27:44.4323429Z ##[debug]found 1 paths
2019-07-18T18:27:44.4323429Z ##[debug]applying include pattern
2019-07-18T18:27:44.4323429Z ##[debug]0 matches
2019-07-18T18:27:44.4323429Z ##[debug]0 final results
2019-07-18T18:27:44.4323429Z ##[debug]Processed: ##vso[task.logissue type=warning;code=002003;]
2019-07-18T18:27:44.4323429Z ##[warning]No results found to publish.
2019-07-18T18:27:44.4323429Z ##[debug]Processed: ##vso[task.issue type=warning;]No results found to publish.
2019-07-18T18:27:44.4323429Z ##[debug]task result: Failed
2019-07-18T18:27:44.4323429Z ##[error]Vstest exited with return code: 1.
2019-07-18T18:27:44.4323429Z ##[debug]Processed: ##vso[task.issue type=error;]Vstest exited with return code: 1.
2019-07-18T18:27:44.4323429Z ##[debug]Processed: ##vso[task.complete result=Failed;]Vstest exited with return code: 1.
2019-07-18T18:27:44.4479679Z ##[section]Finishing: VsTest - testAssemblies

TFS在前提条件下,“ VS Test”任务在Release管道中找不到测试程序集。在构建管道中或从Command Prompt在服务器中本地调用时,相同的测试可以很好地执行。

  1. 在组装管道中标识测试程序集,然后将其从构建服务器复制到开发环境
  2. 测试dll在开发服务器中找到。从命令提示符成功运行了测试,没有任何问题
  3. 已向所有人授予读/写访问权限
  4. 简单的“ hello world”测试,不需要任何包或依赖项

错误:

  

2019-07-16T18:46:50.2821329Z ## [warning]未找到测试程序集   匹配模式: \ xyz.Nunit.UITests.dll,! \ obj **

我的配置中缺少什么?Build Defenition

根据建议进行更新 1.添加了发布任务(复制任务已经存在)。 [在此处输入图片描述] [2]

  1. 错误仍然存​​在

1 个答案:

答案 0 :(得分:0)

根据您的描述,由于构建和远程服务器运行良好,因此这似乎与您发布管道的配置有关。

缺少工件,您需要根据此操作将其添加到构建管道 CopyFile 任务中

  

源文件夹:$(system.defaultworkingdirectory)

     

内容: \ bin \ $(BuildConfiguration)**   ** \ $(BuildConfiguration)* test * .dll! \ obj **

     

目标文件夹:$(build.artifactstagingdirectory)

enter image description here

请在这里看看这个类似的问题:Publishing test assemblies with artifacts in order to use them during functional tests on VSTS