.net - 如何使TeamCity使用MSTest运行测试?

标签 .net continuous-integration teamcity mstest

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

  • MSTest.exe的路径:%system.MSTest.10.0%
  • 列出程序集文件: Projects \ Metadude..Tests \ bin \ Debug \ 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
    

    我尝试使用以下命令指定要运行的测试:
  • 测试: Tests.Metadude.Core.Extensions.StringExtensionsTests

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

    更新
    好吧,我是个白痴。好吧,这可能有点苛刻,但是测试程序集的程序集名称中缺少“s”。虽然会很高兴在构建日志中获得某种效果。

    最佳答案

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



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

    但是,如果您的文件不存在,我希望TC记录一些信息。它看起来像正在运行的MSTest,没有任何参数。

    如果您确定路径正确,请尝试使用该路径而不指定.testsettings文件以查看会发生什么。我没有在TC中成功使用MSTest(但是您可能需要它)。我正在做的另一件事是我指定MSTest.exe的FULL路径,即

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



    而不是他们的变量'%system.MSTest.10.0%'
    我不记得为什么要这么做,但是会有一个很好的理由(例如使用变量时它不起作用)

    关于.net - 如何使TeamCity使用MSTest运行测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8382632/

    相关文章:

    ios - 有时在 CLI 上运行 xcode 测试会返回 "manager not ready"

    c# - 如何读取代码中的输出类型

    .net - 让 TeamCity 读取我的 NUnit 测试配置文件

    c# - 有什么技巧可以计算文本文件中的行数吗?

    c# - 在添加迁移期间忽略来自引用程序集的实体

    c# - KeyDown 事件未触发,KeyPreview 设置为 true

    c++ - Jenkins CI 是否有针对嵌入式的特殊功能?

    teamcity - YouTrack 和 TeamCity 背后的技术堆栈

    tfs - TeamCity 基础知识

    java - 通过 Java 使用 SQLXMLBulkload