【发布时间】:2021-04-27 02:01:24
【问题描述】:
我的项目解决方案基于 Ander's Laub 的 Sitecore Helix Visual Studio 模板。我尝试使用 XUnit 编写单元测试,但没有一个测试正在运行,甚至没有失败。
对于测试项目,我尝试使用基于类库(.NET Framework)的项目,基于 Ander's Laub 的 Sitecore Helix Visual Studio 模板的项目。
使用的包:
- XUnit(2.4.1)
- XUnit.Runner.VisualStudio(2.4.3)
- XUnit.Runner.Console(2.4.1)
框架:.NET 4.8
Visual Studio 2019:v16.8.5
我得到的输出:
由于我无法发布图片,这里是文本资源管理器的详细信息: 小组总结
Linde.Foundation.SitecoreExtensions.Tests
Tests in group: 1
Outcomes
1 Not Run
DemoTests.cs
public class DemoTests
{
[Fact]
public void DemoTestForPassingOnly()
{
double expected = 5;
double actual = 4;
Assert.Equal(expected, actual);
}
}
测试运行输出窗口:
ProjectData: Could not find project with GUID 09fe023c-998c-4a4c-a896-bc27884e7aaf
ProjectData: Could not find project with GUID 09fe023c-998c-4a4c-a896-bc27884e7aaf
---------- Starting test run ----------
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.3+1b45f5407b (64-bit Desktop .NET 4.0.30319.42000)
No test matches the given testcase filter `FullyQualifiedName=Linde.Foundation.SitecoreExtensions.Tests.DemoTests.DemoTestForPassingOnly` in C:\SourceTree\lindemh-sitecore\bin\Debug\Linde.Foundation.SitecoreExtensions.Tests.dll
========== Test run finished: 0 Tests run in 1.3 sec (0 Passed, 0 Failed, 0 Skipped) ==========
我已尝试使用测试项目构建单独的控制台应用程序,以确保这是否是 Visual Studio 问题,但它在控制台应用程序中运行/失败/通过,而不是在 Sitecore 项目中。
我是否必须以不同方式配置解决方案才能使测试成功运行?
【问题讨论】: