MyProject.dll 中没有可用的测试,但测试资源管理器显示了它们
No test is available in MyProject.dll., but Test Explorer shows them
我不能 运行 在我的项目中进行单元测试,大约 4 天前,我已经尝试了很多 SO 中存在的解决方案,但没有任何帮助。
No test is available in Path\To\My\TestProject.dll. Make sure that
test discoverer & executors are registered and platform & framework
version settings are appropriate and try again.
测试资源管理器显示我的测试,但不能 运行 它们。
顺便说一句。这些是 WPF C# 项目。
我用这样的测试方法测试 类:
[TestFixture]
[Category("Something")]
public class SomeTestClass
{
[Test]
public void SomeMethodThatDoesntWork()
{
using (var ms = new MemoryStream())
{
System.Diagnostics.Debugger.Launch();
Option savedOptions = new ....
...
我的解决方案中有 3 个项目,每个项目的 目标框架都是 .NET 4.5.2,每个项目的 平台目标是 x64 .
NuGet 包:NUnit 2.6.4 和 NUnit3TestAdapter 3.12.0。
NUnit 2.6.4 因为我有一些属性,例如 ExpectedExceptionAttribute,这些属性已在较新的 NUnit 版本中删除。
我已经将 Test\Test Settings\Default 处理器架构设置为 x64,也尝试过 x86。
测试控制台输出:
测试探索者:
你可以试试this我可以解决你的问题
此外,您可以在最新版本的 NUnit 中将 ExpectedExceptionAttribute 属性更改为 (或评论中的其他示例)或仅使用以下断言:
Assert.Throws<Exception>(() =>
{
// Test Code
});
终于在大约 2 天内解决了我的问题。
存在那些 Visual Studio 无法注意到的 DLL 依赖项,也没有向我显示任何警告或错误。
Dependency Walker 帮助我找到了我的 DLL 的依赖项。
所以我又学到了什么? Visual Studio 可能有问题,有时也不是很聪明。
为我解决的是:
- 转到 SELECT -> 'Test' 选项卡 -> 测试设置 -> 默认处理器架构 -> x64**
运行 测试。
我不能 运行 在我的项目中进行单元测试,大约 4 天前,我已经尝试了很多 SO 中存在的解决方案,但没有任何帮助。
No test is available in Path\To\My\TestProject.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
测试资源管理器显示我的测试,但不能 运行 它们。
顺便说一句。这些是 WPF C# 项目。
我用这样的测试方法测试 类:
[TestFixture]
[Category("Something")]
public class SomeTestClass
{
[Test]
public void SomeMethodThatDoesntWork()
{
using (var ms = new MemoryStream())
{
System.Diagnostics.Debugger.Launch();
Option savedOptions = new ....
...
我的解决方案中有 3 个项目,每个项目的 目标框架都是 .NET 4.5.2,每个项目的 平台目标是 x64 .
NuGet 包:NUnit 2.6.4 和 NUnit3TestAdapter 3.12.0。
NUnit 2.6.4 因为我有一些属性,例如 ExpectedExceptionAttribute,这些属性已在较新的 NUnit 版本中删除。
我已经将 Test\Test Settings\Default 处理器架构设置为 x64,也尝试过 x86。
测试控制台输出:
测试探索者:
你可以试试this我可以解决你的问题
此外,您可以在最新版本的 NUnit 中将 ExpectedExceptionAttribute 属性更改为
Assert.Throws<Exception>(() =>
{
// Test Code
});
终于在大约 2 天内解决了我的问题。
存在那些 Visual Studio 无法注意到的 DLL 依赖项,也没有向我显示任何警告或错误。 Dependency Walker 帮助我找到了我的 DLL 的依赖项。
所以我又学到了什么? Visual Studio 可能有问题,有时也不是很聪明。
为我解决的是:
- 转到 SELECT -> 'Test' 选项卡 -> 测试设置 -> 默认处理器架构 -> x64**
运行 测试。