Azure Pipelines中VSTest@2任务如何自定义TRX测试结果文件名
解决Azure Pipelines VSTest@2任务指定TRX文件名的问题
要让VSTest@2任务生成指定名称的TRX文件,只需在任务的inputs中添加resultsFileName参数,将其值设置为你需要的文件名(比如testResults.trx)即可。
修改后的完整任务配置如下:
- task: VSTest@2 displayName: Unit Tests inputs: testSelector: 'testAssemblies' testAssemblyVer2: '*(*.Test)*(*.Integration).dll' searchFolder: '$(Agent.BuildDirectory)\git\test-bin' resultsFolder: '$(Agent.BuildDirectory)\git\testsResult\unitTest' resultsFileName: 'testResults.trx' # 新增参数,指定TRX文件名 vsTestVersion: 'toolsInstaller' testFiltercriteria: 'TestCategory!=Integration' runSettingsFile: 'CodeCoverage.runsettings' codeCoverageEnabled: true
添加resultsFileName参数后,任务会在你指定的resultsFolder路径下生成名为testResults.trx的测试结果文件,替换默认生成的随机命名文件。
内容的提问来源于stack exchange,提问作者wolfdebs
相关产品推荐
相关产品推荐

