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

Les*_*nks 21 .net teamcity continuous-integration mstest

我想弄清楚如何让TeamCity运行我的MSTests.我使用以下参数设置了构建步骤:

  • MSTest.exe的路径:%system.MSTest.10.0%
  • 列出程序集文件: Projects\Metadude..Tests\BIN \调试\ Metadude..Test.dll
  • MSTest运行配置文件: Local.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
Run Code Online (Sandbox Code Playgroud)

我试图使用以下内容指定要运行的测试:

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

但这不起作用.我似乎无法在谷歌上找到与TeamCity中的MSTest构建步骤相关的任何文档.

更新 好的,我是个白痴.好吧,这可能有点苛刻,但测试组件缺少程序集名称中的"s".本来很高兴在构建日志中获得某些效果.

wal*_*wal 20

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

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

但是,如果您的文件不存在,我会期望TC记录的内容.看起来它的运行MSTest没有任何参数.

如果您确定路径是正确的,请尝试在不指定.testsettings文件的情况下查看发生的情况.我在没有这个的情况下在TC中成功使用MSTest(但你可能需要它).我正在做的另一件事是我指定FULL路径MSTest.exe,即

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

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

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

  • 由于Visual Studio 2012(至少是快速版本)MsTest.exe被称为`vstest.console.exe`,可以在`C:\ Program Files(x86)\ Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft找到\ TestWindow\vstest.console.exe` (6认同)