Я не могу запустить какие-либо тесты xunit в моем решении. Проводник тестов Visual Studio находит их, но кажется, что бегун не может их найти.
Характеристики:
- Visual studio 2017 15.9.13
- .NET Core 2.2
Проблема, в частности, связана с тестовыми проектами XUnit, поскольку проекты NUnit и MsTest обычно проходят тесты. Все пакеты в проекте XUnit обновлены (на момент написания этой статьи):
- Microsoft.NETCore.App 2.2.0
- Microsoft.NET.Test.Sdk 16.3. 0
- xunit 2.4.1
- xunit.runner.visualstudio 2.4.1
Кроме того, проблема заключается только в этом решении, поскольку в новом решенииТесты xunit работают нормально.
У меня есть уровень журнала диагностики для тестов, и я вижу, что он говорит, что не может найти ни одного теста.
Это:
Test framework could not be determined for project: C:\path\to\my\project\XUnitTestProject1\bin\Debug\netcoreapp2.2\XUnitTestProject1.dll because reference path is null for at least one reference: Microsoft.NETCore.App
И это:
No test is available in C:\path\to\my\project\XUnitTestProject1\bin\Debug\netcoreapp2.2\XUnitTestProject1.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
Мой тестовый класс
using Xunit;
namespace XUnitTestProject1
{
public class MyTestClass
{
[Fact]
public void some_tests()
{
Assert.True(true);
}
}
}
Полный журнал на панели вывода
[10/21/2019 10:17:39 AM Diagnostic] About to Enqueue operation 'RunSelectedOperation', hashcode:37960157
[10/21/2019 10:17:39 AM Diagnostic] Enqueue operation 'RunSelectedOperation', hashcode:37960157
[10/21/2019 10:17:39 AM Diagnostic] Operation left in the the queue: 1
[10/21/2019 10:17:39 AM Diagnostic] 'RunSelectedOperation', hashcode:37960157
[10/21/2019 10:17:39 AM Diagnostic]
[10/21/2019 10:17:39 AM Diagnostic] Processing Queue .....
[10/21/2019 10:17:39 AM Diagnostic] Operation Dequeue : 'RunSelectedOperation'
[10/21/2019 10:17:39 AM Diagnostic] VirtualReadOnlyTestDataStore.OperationStateChanged State=OperationSetStarted, operationInProgress=False
[10/21/2019 10:17:39 AM Diagnostic] TestDiscoveryStats.OperationStateChanged State=OperationSetStarted, InProgress=False
[10/21/2019 10:17:39 AM Diagnostic] VirtualReadOnlyTestDataStore.OperationStateChanged State=ChangeDetectionStarting, operationInProgress=True
[10/21/2019 10:17:39 AM Diagnostic] TestDiscoveryStats.OperationStateChanged State=ChangeDetectionStarting, InProgress=False
[10/21/2019 10:17:39 AM Diagnostic] We programmatically start the build in TestWindowHost.UpdateContainer...
[10/21/2019 10:17:39 AM Diagnostic] After we await the build that programmatically started in TestWindowHost.UpdateContainer...
[10/21/2019 10:17:39 AM Diagnostic] TestContainer update (build) complete : 405 ms
[10/21/2019 10:17:39 AM Diagnostic] Time taken for fetching Roslyn supported projects: 0 milliseconds.
[10/21/2019 10:17:39 AM Diagnostic] DiscoveryOperation<RunSelectedOperation> FinishedChangedCotainers, changed container count is 0
[10/21/2019 10:17:39 AM Diagnostic] VirtualReadOnlyTestDataStore.OperationStateChanged State=ChangeDetectionFinished, operationInProgress=False
[10/21/2019 10:17:39 AM Diagnostic] Test framework could not be determined for project: C:\path\to\my\project\XUnitTestProject1\bin\Debug\netcoreapp2.2\XUnitTestProject1.dll because reference path is null for at least one reference: Microsoft.NETCore.App
[10/21/2019 10:17:39 AM Diagnostic] TestDiscoveryStats.OperationStateChanged State=ChangeDetectionFinished, InProgress=False
[10/21/2019 10:17:39 AM Diagnostic] VirtualReadOnlyTestDataStore.OperationStateChanged State=TestExecutionStarting, operationInProgress=False
[10/21/2019 10:17:39 AM Diagnostic] TestDiscoveryStats.OperationStateChanged State=TestExecutionStarting, InProgress=False
[10/21/2019 10:17:39 AM Diagnostic] VirtualReadOnlyTestDataStore.OperationStateChanged State=TestExecutionStarted, operationInProgress=False
[10/21/2019 10:17:39 AM Informational] ------ Run test started ------
[10/21/2019 10:17:39 AM Diagnostic] TestDiscoveryStats.OperationStateChanged State=TestExecutionStarted, InProgress=False
[10/21/2019 10:17:39 AM Diagnostic] RunSettings Content:
<RunSettings>
<RunConfiguration>
<ResultsDirectory>C:\path\to\my\project\TestResults</ResultsDirectory>
<SolutionDirectory>C:\path\to\my\project\</SolutionDirectory>
<TargetPlatform>X64</TargetPlatform>
<TargetFrameworkVersion>Framework45</TargetFrameworkVersion>
</RunConfiguration>
</RunSettings>
[10/21/2019 10:17:39 AM Diagnostic] Value of UseSpecifiedAdapterLocations as specified in Tools -> Options: True
[10/21/2019 10:17:39 AM Diagnostic] Value of FallbackToGlobalVsix as specified in Tools -> Options: True
[10/21/2019 10:17:39 AM Diagnostic] Adapter location settings being used after evaluation: UseSpecifiedAdapterLocations = False, SkipDefaultAdapters = False, AreAllTestContainersCSharpOrVBProjectsOnly = True
[10/21/2019 10:17:39 AM Diagnostic] Final RunSettings for the current TestRunCriteria:
<RunSettings>
<RunConfiguration>
<ResultsDirectory>C:\path\to\my\project\TestResults</ResultsDirectory>
<SolutionDirectory>C:\path\to\my\project\</SolutionDirectory>
<TargetPlatform>X64</TargetPlatform>
<TargetFrameworkVersion>FrameworkCore10</TargetFrameworkVersion>
<CollectSourceInformation>False</CollectSourceInformation>
</RunConfiguration>
</RunSettings>
[10/21/2019 10:17:40 AM Warning] No test is available in C:\path\to\my\project\XUnitTestProject1\bin\Debug\netcoreapp2.2\XUnitTestProject1.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[10/21/2019 10:17:40 AM Diagnostic] VirtualReadOnlyTestDataStore.OperationStateChanged State=OperationSetFinished, operationInProgress=False
[10/21/2019 10:17:40 AM Diagnostic] TestDiscoveryStats.OperationStateChanged State=OperationSetFinished, InProgress=False
[10/21/2019 10:17:40 AM Diagnostic] *** Run finished using 'InMemoryUnitTestWriter' ***
[10/21/2019 10:17:40 AM Informational] ========== Run test finished: 0 run (0:00:00.7402273) ==========
[10/21/2019 10:17:40 AM Diagnostic] VirtualReadOnlyTestDataStore.OperationStateChanged State=TestExecutionFinished, operationInProgress=False
[10/21/2019 10:17:40 AM Diagnostic] TestDiscoveryStats.OperationStateChanged State=TestExecutionFinished, InProgress=False