You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.25 13:24:24