如何获得TeamCity的使用MSTest的运行测试? [英] How to get TeamCity to run tests using MSTest?

查看:234
本文介绍了如何获得TeamCity的使用MSTest的运行测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出如何使TeamCity的运行我MSTests。我用下面的参数已经建立了构建步骤:

I am trying to figure out how to make TeamCity run my MSTests. I have setup a build step using the following parameters:

  • 路径MSTest.exe:%system.MSTest.10.0%
  • 列表集文件:项目\ Metadude的 .Tests \斌\调试\ Metadude 的.Test.dll
  • MSTest的运行配置文件: Local.testsettings
  • 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.Metadude.Core.Extensions.StringExtensionsTests
  • Tests: Tests.Metadude.Core.Extensions.StringExtensionsTests

但是,这并不正常工作。我似乎无法找到相关的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..Tests \斌\调试\ Metadude..Test.dll

your relative path: Projects\Metadude..Tests\bin\Debug\Metadude..Test.dll

不过,我希望通过一些技术合作记录,如果你的文件didnt存在。它看起来像它的运行 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 Files文件\微软的Visual Studio 10.0 \ Common7 \ IDE \ MSTest.exe

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

我不记得我为什么这样做,但也将是一个很好的理由(喜欢使用他们的变量时没有工作)

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的运行测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆