我在尝试设置单元测试时遇到了麻烦。我的测试类很简单,看起来像这样:
TEST_CLASS(BlahSpec)
{
public:
TEST_METHOD(blahFunc)
{
int res = doSomething(); // this is what I'm testing
Assert::AreEqual (42, res, L"Blah", LINE_INFO());
}
};
项目编译并运行良好。但是,当我选择TEST>运行>所有测试,我收到以下错误:
Cannot discover test extensions installed by NuGet. The NuGet service is not
available. Tests may not be found due to missing test adapter extensions
我是否必须下载NuGet包才能获得C ++的单元测试? 如果是这样,我应该下载哪些NuGet软件包?我不想要任何花哨的第三方软件包,我只需要微软默认的东西。但是,NuGet扩展管理器并没有向我显示任何似乎来自Microsoft的内容。
编辑:我已经随机选择了一个NuGet包,NUnit3并安装了它。现在我收到以下错误:Error: Unable to get runner for this assembly. Check installation, including any extensions.
BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
Assembly not supported: C:\Develop\test-project\projects\Debug\UnitTestApp1\UnitTestApp1.exe
看起来,NUnit3似乎不是C ++原生单元测试的正确选择。我应该选择哪个NuGet包?