如何让 TeamCity 使用 MSTest 运行测试?

2023-12-23

我正在尝试弄清楚如何让 TeamCity 运行我的 MSTest。我使用以下参数设置了构建步骤:

  • MSTest.exe 的路径:%system.MSTest.10.0%
  • 列出汇编文件:项目\Metadude。.Tests\bin\Debug\Metadude。.Test.dll
  • MSTest运行配置文件:本地.testsettings

但是,当此步骤运行时,它不会执行任何测试。这是日志的输出:

[02:13:49]: Step 2/2: Run Unit Tests (MSTest)
[02:13:49]: [Step 2/2] Starting: "D:\Program Files (x86)\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe" #TeamCityImplicit
[02:13:49]: [Step 2/2] in directory: D:\Program Files (x86)\TeamCity\buildAgent\work\1f82da3df0f560b6
[02:13:50]: [Step 2/2] Microsoft (R) Test Execution Command Line Tool Version 10.0.30319.1
[02:13:50]: [Step 2/2] Copyright (c) Microsoft Corporation. All rights reserved.
[02:13:50]: [Step 2/2]
[02:13:50]: [Step 2/2] Please specify tests to run, or specify the /publish switch to publish results.
[02:13:50]: [Step 2/2] For switch syntax, type "MSTest /help"
[02:13:50]: [Step 2/2] Process exited with code 1
[02:13:50]: Publishing internal artifacts
[02:13:50]: [Publishing internal artifacts] Sending build.finish.properties.gz file
[02:13:50]: Build finished

我尝试使用以下命令指定要运行的测试:

  • Tests:Tests.Metadude.Core.Extensions.StringExtensions 测试

但这是行不通的。我似乎在 google 上找不到任何与 TeamCity 中的 MSTest 构建步骤相关的文档。

UPDATE好吧,我是个白痴。好吧,这可能有点苛刻,但测试程序集的程序集名称中缺少一个“s”。不过,如果能在构建日志中得到一些达到这种效果的东西就好了。


首先,确保您尝试测试的程序集存在于该位置。

ie

你的相对路径: 项目\Metadude..Tests\bin\Debug\Metadude..Test.dll

不过,如果您的文件不存在,我希望 TC 会记录一些内容。看起来它正在运行MSTest没有任何争论。

如果您确定路径正确,请尝试不指定.testsettings文件看看会发生什么。我在 TC 中成功使用 MSTest,没有这个(但你可能需要它)。我做的另一件事是我指定了完整路径MSTest.exe, ie

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe

而不是他们的变量'%system.MSTest.10.0%'

我不记得为什么我这样做,但会有一个很好的理由(就像使用他们的变量时它不起作用)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何让 TeamCity 使用 MSTest 运行测试? 的相关文章

随机推荐