我想弄清楚如何让 TeamCity 运行我的 MSTest.我已经使用以下参数设置了构建步骤:
I am trying to figure out how to make TeamCity run my MSTests. I have setup a build step using the following parameters:
但是,当此步骤运行时,它不会执行任何测试.这是日志的输出:
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)TeamCityuildAgentpluginsdotnetPlugininJetBrains.BuildServer.NUnitLauncher.exe" #TeamCityImplicit
[02:13:49]: [Step 2/2] in directory: D:Program Files (x86)TeamCityuildAgentwork1f82da3df0f560b6
[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:
但这不起作用.我似乎在 Google 上找不到任何与 TeamCity 中的 MSTest 构建步骤相关的文档.
But that doesn't work. I can't seem to find any documentation on google related to the MSTest build step in TeamCity.
更新好吧,我是个白痴.好吧,这可能有点苛刻,但是测试程序集的程序集名称中缺少一个s".不过,如果能在构建日志中得到这样的效果,那就太好了.
UPDATE Ok, 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.
即
您的相对路径:项目Metadude..TestsinDebugMetadude..Test.dll
your relative path: ProjectsMetadude..TestsinDebugMetadude..Test.dll
但是,如果您的文件不存在,我希望 TC 会记录一些内容.看起来它正在运行的 MSTest
没有任何参数.
However I would expect something logged by TC if your file didnt exist. It looks like its running MSTest
without any arguments somehow.
如果您确定路径正确,请尝试在不指定 .testsettings
文件的情况下进行尝试,看看会发生什么.我在没有这个的情况下在 TC 中成功使用了 MSTest(但你可能需要它).我正在做的另一件事是我指定 MSTest.exe
的完整路径,即
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
C:Program FilesMicrosoft Visual Studio 10.0Common7IDEMSTest.exe
C:Program FilesMicrosoft Visual Studio 10.0Common7IDEMSTest.exe
而不是他们的变量'%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 运行测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!