【问题标题】:How to run Mstests on a Mac?如何在 Mac 上运行 Mstests?
【发布时间】:2011-09-02 20:53:40
【问题描述】:

我需要编写一些 mstest 并在 Mac 上运行这些测试。正在测试的源代码的二进制文件已经在 Mac 上启动并运行。

要运行用 Visual Studio 编写的自动化测试,我是否遵循相同的流程?关于如何开始在 Mac 上使用 Mono 运行这些测试用例的任何指示?

【问题讨论】:

  • 这听起来你最终会测试你的环境而不是实际的产品。
  • 由于 Mono 不支持运行 MStest,我基本上是在寻找一种在 Mac 上运行测试自动化的方法
  • 您应该使用 .NET Core(它支持使用 MSTest、NUnit 和 xUnit.net 进行单元测试)。 docs.microsoft.com/en-us/dotnet/core/testing/…

标签: macos visual-studio-2010 mono automated-tests


【解决方案1】:

我知道这个问题很老,但我在寻找在我的 mac 上运行 MSTest 的解决方案时遇到了它。我将调查上述内容,但还值得注意的是,VS 4 Mac 上的 MSTest 支持迫在眉睫:

Visual Studio for Mac 中的 MSTest 支持将在 15.5 发布周期(即 VSfM 7.3)中提供,该版本计划在几周内进入 Alpha 通道。 (2017 年 9 月 20 日)

See this github issue

但是 - 如果你等不及 - 你可以使用 dotnet cli 命令:

dotnet 测试 CreditCardValidator.iOS.MSTestAppium/CreditCardValidator.iOS.MSTestAppium.csproj

构建开始,请稍候...构建完成。

试运行 /Users/owenniblock/test-apps/CCExampleAppium/CreditCardValidator.iOS.MSTestAppium/bin/Debug/netcoreapp2.0/CreditCardValidator.iOS.MSTestAppium.dll(.NETCoreApp,Version=v2.0) Microsoft (R) 测试执行命令行工具版本

15.3.0-preview-20170628-02 版权所有 (c) Microsoft Corporation。保留所有权利。

开始测试执行,请稍候...失败

CreditCardValidator.iOS.MSTestAppium.Tests.IntentionalFailure 错误 消息:Assert.IsTrue 失败。堆栈跟踪:在 CreditCardValidator.iOS.MSTestAppium.Tests.IntentionalFailure() 在 /Users/owenniblock/test-apps/CCExampleAppium/CreditCardValidator.iOS.MSTestAppium/Tests.cs:line 21

测试总数:3.通过:2.失败:1.跳过:0.测试运行失败。

测试执行时间:1.0736 秒

【讨论】:

    【解决方案2】:

    现在看来这是可能的,但您必须自己构建可执行文件(此时):
    https://github.com/Microsoft/testfx
    https://github.com/Microsoft/testfx-docs/blob/master/docs/contribute.md#building-with-visual-studiovs

    您应该遵循“使用 Visual Studio 构建”说明,使用 VS for Mac 或 Xamarin Studio。

    更新:我自己尝试使用 VS for Mac v.7.1.3 并没有成功。理论上,这是可能的,但是……正如您在 GitHub 上看到的那样,如果没有合适的问题,您应该可以在那里提交问题。

    【讨论】:

      【解决方案3】:

      同样,我在尝试在项目上实现 MSTest 时遇到了这个问题,我可以确认 VS 4 Mac v8.8 支持 MSTest 并且它们运行良好。

      【讨论】:

        猜你喜欢
        • 2021-07-01
        • 2012-08-31
        • 2019-04-21
        • 1970-01-01
        • 2020-04-25
        • 1970-01-01
        • 1970-01-01
        • 2021-06-04
        • 1970-01-01
        相关资源
        最近更新 更多