Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamicData in vscode test explorer are split #2459

Closed
nohwnd opened this issue Feb 27, 2024 · 11 comments
Closed

DynamicData in vscode test explorer are split #2459

nohwnd opened this issue Feb 27, 2024 · 11 comments
Assignees

Comments

@nohwnd
Copy link
Member

nohwnd commented Feb 27, 2024

I also have a issue with DynamicData in vscode test explorer. same cause here?

image

Originally posted by @xcaptain in #2237 (comment)

@nohwnd
Copy link
Member Author

nohwnd commented Feb 27, 2024

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?

@xcaptain
Copy link

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>

@Evangelink
Copy link
Member

Evangelink commented Mar 2, 2024

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

@xcaptain
Copy link

xcaptain commented Mar 3, 2024

Tests display in vs2022 is good

image

@Evangelink
Copy link
Member

@drognanar could you please investigate?

@drognanar
Copy link
Member

@xcaptain, what version of vscode dev kit are you using?

I'm currently cannot reproduce this issue:

image

@xcaptain
Copy link

xcaptain commented Mar 6, 2024

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.
image

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.
image

So according to my rough thinking, I think there exists 2 problems:

  1. vscode C# dev kit (preview) is not compatible with the new MSTest runner, causing splitted display
  2. vscode C# devkit (release) can't detect the real exe file for the test project

@xcaptain
Copy link

xcaptain commented Mar 6, 2024

I then copied my test project to windows, and vscode test explorer is good in windows.
image

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.

@drognanar
Copy link
Member

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.

@drognanar
Copy link
Member

@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

@xcaptain
Copy link

C# devkit(preview) in wsl is good for me now, I think it's ok to close this issue, thanks you for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants