问题描述
我想弄清楚如何让TeamCity运行我的MSTests。我已使用以下参数设置了构建步骤:
- MSTest.exe的路径:%system.MSTest .10.0%
- 列出程序集文件:Projects \Metadude .Tests\bin\Debug\Metadude。。 Test.dll
- MSTest运行配置文件:Local.testsettings
但是,当此步骤运行时,它不执行任何测试。这是日志的输出:
[02:13:49]:步骤2/2:运行单元测试)
[02:13:49]:[步骤2/2]开始:D:\Program Files(x86)\TeamCity\buildAgent\plugins\dotnetPlugin\bin/\\JetBrains。 BuildServer.NUnitLauncher.exe#TeamCityImplicit
[02:13:49]:[步骤2/2]在目录:D:\Program Files(x86)\TeamCity\buildAgent\work\1f82da3df0f560b6
[02:13:50]:[步骤2/2] Microsoft(R)测试执行命令行工具版本10.0.30319.1
[02:13:50]:[步骤2/2] (c)Microsoft Corporation。版权所有。
[02:13:50]:[步骤2/2]
[02:13:50]:[步骤2/2]请指定要运行的测试,或指定/ publish开关以发布结果。
[02:13:50]:[步骤2/2]对于switch语法,输入MSTest / help
[02:13:50]:[步骤2/2] 1
[02:13:50]:发布内部工件
[02:13:50]:[发布内部工件]发送build.finish.properties.gz文件
[02:13 :50]:Build finished
我试图指定要使用以下命令运行的测试: p>
- 测试: Tests.Metadude.Core.Extensions.StringExtensionsTests
但这不行。我似乎找不到任何与谷歌相关的任何文档在TeamCity的MSTest构建步骤。
UPDATE
Ok,I我是白痴。这可能有点苛刻,但测试程序集从组件名称中缺少一个s。
首先,确保你正在尝试的程序集测试存在于该位置。
即
您的相对路径:
Projects \Metadude。 .Tests\bin\Debug\Metadude..Test.dll
但是,如果您的文件不存在,我希望TC记录的内容。它看起来像运行 MSTest
没有任何参数以某种方式。
如果你确定路径是正确的,指定 .testsettings
文件以查看会发生什么。我使用MSTest成功地在TC没有这个(但你可能需要它)。另一件事我做不同的是我指定 MSTest.exe
的完整路径,即
而不是它们的变量'%system.MSTest.10.0%'
我不记得为什么这将是一个很好的理由(如果它不工作,当使用他们的变量)
I am trying to figure out how to make TeamCity run my MSTests. I have setup a build step using the following parameters:
- Path to MSTest.exe: %system.MSTest.10.0%
- List assembly files: Projects\Metadude..Tests\bin\Debug\Metadude..Test.dll
- MSTest run configuration file: Local.testsettings
However when this step runs, it does not execute any tests. This is the output from the log:
[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
I have tried to specify the tests to run using the following:
- Tests: Tests.Metadude.Core.Extensions.StringExtensionsTests
But that doesn't work. I can't seem to find any documentation on google related to the MSTest build step in TeamCity.
UPDATEOk, I am an idiot. Well that might be a little harsh, but the test assembly was missing an "s" from the assembly name. Would have been nice to get something to that effect in the build log though.
Firstly, Ensure the assembly you are trying to test exists at that location.
ie
your relative path: Projects\Metadude..Tests\bin\Debug\Metadude..Test.dll
However I would expect something logged by TC if your file didnt exist. It looks like its running MSTest
without any arguments somehow.
If you are sure the path is correct try it without specifying the .testsettings
file to see what happens. I'm using MSTest succesfully in TC without this (but you may need it). The other thing I'm doing different is I specify the FULL path to MSTest.exe
, ie
instead of their variable '%system.MSTest.10.0%'
I can't recall why I did this but there would have been a good reason (like it didnt work when using their variable)
这篇关于如何获取TeamCity使用MSTest运行测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!