gpt4 book ai didi

c# - Mac 上的 Visual Studio(C#、.net Core)上的 XUnit testrunner 未提取测试

转载 作者:太空宇宙 更新时间:2023-11-03 15:06:23 25 4
gpt4 key购买 nike

我在 Mac 上运行 Visual Studio(预览版 5,最新),我正在尝试使用 Xunit 进行单元测试。

我为 .NET Core 创建了一个新项目 -> 测试创建了以下内容示例代码

using System;
using Xunit;

namespace SMASHDOCsTests
{
public class UnitTest1
{
[Fact]
public void testFoo()
{
return;
}
}
}

我能够正确编译代码,但是我无法执行测试。

它总是提示“内部错误:无法运行测试,测试发现失败”。

如何追踪或解决此错误?

最佳答案

我当前的 Visual Studio for Mac 版本是 (v7.0.1.24)——这就是我解决内部警告问题的方法:

  1. 更新包 block (位于 fileTree 边栏中)enter image description here

  2. 按照 this 上的说明进行操作页面并安装扩展。注意 mac 的异常(exception)情况:

IMPORTANT: Starting from v0.7.3, please download the .mpack files from https://github.com/xunit/xamarinstudio.xunit/releases Then in Extension Manager you can use "Install from file..." button to manually install this extension.

这让我运行我的测试并在 UI 中给我反馈:

[TestFixture()]
public class Test
{
[Test()]
public void TestCase()
{
int a = 100;
int b = 100;

Assert.AreEqual(a, b);
}
}

enter image description here

关于c# - Mac 上的 Visual Studio(C#、.net Core)上的 XUnit testrunner 未提取测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43328489/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com