在Mac上的Visual Studio上使用XUnit testrunner没有找到测试
问题描述:
我在Mac上运行Visual Studio(预览版5,最新版本),我正在尝试使用Xunit进行单元测试。在Mac上的Visual Studio上使用XUnit testrunner没有找到测试
我创建了一个新的项目.NET核心 - >试验,这将创建下列 示例代码
using System;
using Xunit;
namespace SMASHDOCsTests
{
public class UnitTest1
{
[Fact]
public void testFoo()
{
return;
}
}
}
我能够正确编译代码,但是我不能执行测试。
它总是抱怨“内部错误:无法运行测试,测试发现失败”。
如何跟踪这个错误或解决它?
答
我目前的Mac版本的Visual Studio是(v7.0.1.24) - 这是我解决了问题与内部警告:
按照this页上的说明进行操作并安装扩展。注意MAC例外:
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);
}
}
此扩展仅适用于non-.NET核心项目。 –