testfx
testfx copied to clipboard
`DynamicData` in vscode test explorer are split
I also have a issue with DynamicData
in vscode test explorer. same cause here?
Originally posted by @xcaptain in https://github.com/microsoft/testfx/issues/2237#issuecomment-1963996602
Moved your issue here @xcaptain, the other issue was a work item to create an analyzer, and not an issue report.
Are you using mstest runner (MSTest 3.2.0+ with EnableMSTestRunner) to run your tests in vscode? Or the standard mstest?
@drognanar could you help here please?
Yes, I'm using MSTest: 3.2.1
, below are my test project 's config
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Enable the MSTest runner, this is an opt-in feature -->
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MSTest" Version="3.2.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CsPractice\CsPractice.csproj" />
</ItemGroup>
</Project>
The return type is expected to be IEnumerable<object[]>
or IEnumerable<(Value)Tuple>
, yours is IEnumerable<int[][]>
so I think this is messing up the display. There's definitely something that should be fixed on MSTest side for this case.
I haven't investigated so I am not sure if we should just consider this case invalid or consider that the 2 level of array is the value of each "item".
We should test if the display is different between VS and VS Code, if that's the case then there is a bug in Test Explorer too.
cc @MarcoRossignoli
Tests display in vs2022 is good
@drognanar could you please investigate?
@xcaptain, what version of vscode dev kit are you using?
I'm currently cannot reproduce this issue:
I was using the C# devkit preview version got the above splitted rows. But now I tried switch to the release version, the test explore shows nothing.
In vscode C# devkit test explorer output, I found these logs
Initialized project system provider.
1 projects added, 0 changed, 0 removed.
Scheduling discovery: /home/joey/github/demo1/artifacts/bin/CsPractice.Tests/debug/CsPractice.Tests.dll [1709739288831]
========== 正在启用测试发现 ==========
System.ComponentModel.Win32Exception (2): An error occurred trying to start process '/home/joey/github/demo1/artifacts/bin/CsPractice.Tests/debug/CsPractice.Tests.exe' with working directory '/home/joey/github/demo1/artifacts/bin/CsPractice.Tests/debug'. No such file or directory
at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at Microsoft.VisualStudio.TestWindow.Internal.RemoteAgent.TestingPlatform.TestingPlatformRunnerProcess.StartAsync()
at Microsoft.VisualStudio.TestWindow.Internal.RemoteAgent.TestingPlatform.Providers.ClientServerProvider.StartProcessWithoutDebuggerAsync(TestingPlatformLaunchConfig config)
无法启动测试平台运行器进程“/home/joey/github/demo1/artifacts/bin/CsPractice.Tests/debug/CsPractice.Tests.exe”。
========== 测试发现已中止: 69.1 毫秒 中发现 0 个测试 ==========
0 tests discovered from in 69.1156 ms
But in my artifacts
directory, there is no CsPractice.Tests.exe
file, I'm using wsl.
So according to my rough thinking, I think there exists 2 problems:
- vscode C# dev kit (preview) is not compatible with the new MSTest runner, causing splitted display
- vscode C# devkit (release) can't detect the real exe file for the test project
I then copied my test project to windows, and vscode test explorer is good in windows.
The C# devkit test explorer log is also good:
3 tests discovered from C:\Users\capta\Downloads\demo1\artifacts\bin\CsPractice.Tests\debug\CsPractice.Tests.dll in 8754.412 ms
So the problem should be vscode C# devkit test explorer is not displaying well on wsl.
Sorry for your time.
if you create a .vscode/settings.json you can add the following setting:
{
"dotnet.testWindow.useTestingPlatformProtocol": false
}
we've fixed the wsl support, but that hasn't been released yet. with this setting DevKit should fallback on an older way that we used to run tests until the bug fix is released.
@xcaptain can you try it with the latest version of DevKit? I don't see any issues with the tree anymore and the code works both with the protocol setting enabled and disabled
C# devkit(preview) in wsl is good for me now, I think it's ok to close this issue, thanks you for the help.