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

No possibility to run tests with long VSTestTestCaseFilter #2764

Closed
ch1seL opened this issue Feb 20, 2021 · 5 comments
Closed

No possibility to run tests with long VSTestTestCaseFilter #2764

ch1seL opened this issue Feb 20, 2021 · 5 comments

Comments

@ch1seL
Copy link

ch1seL commented Feb 20, 2021

Description

I think this problem connected with Win API. CreateProccessA function has a limitation on lpCommandLine parameter. lpCommandLine. The maximum length of this string is 32,767 characters

Steps to reproduce

  • compose file with hundreds of test case filters, for example, tests.rsp:
    /p:VSTestTestCaseFilter=(FullyQualifiedName="Test1")|(FullyQualifiedName="Test2")|...|(FullyQualifiedName="Test9999")
  • run dotnet test @tests.rsp

Expected behavior

tests should be run

Actual behavior

task failed unexpectedly

Diagnostic logs

C:\Program Files\dotnet\sdk\5.0.103\Microsoft.TestPlatform.targets(32,5): error MSB4018: System.ComponentModel.Win32Exception (206): The filename or extension is too long.
C:\Program Files\dotnet\sdk\5.0.103\Microsoft.TestPlatform.targets(32,5): error MSB4018:    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
C:\Program Files\dotnet\sdk\5.0.103\Microsoft.TestPlatform.targets(32,5): error MSB4018:    at System.Diagnostics.Process.Start()
C:\Program Files\dotnet\sdk\5.0.103\Microsoft.TestPlatform.targets(32,5): error MSB4018:    at Microsoft.TestPlatform.Build.Tasks.VSTestForwardingApp.Execute()
C:\Program Files\dotnet\sdk\5.0.103\Microsoft.TestPlatform.targets(32,5): error MSB4018:    at Microsoft.TestPlatform.Build.Tasks.VSTestTask.Execute()
C:\Program Files\dotnet\sdk\5.0.103\Microsoft.TestPlatform.targets(32,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
C:\Program Files\dotnet\sdk\5.0.103\Microsoft.TestPlatform.targets(32,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)

Environment

OS Name: Microsoft Windows Server 2016 Standard
OS Version: 10.0.14393 N/A Build 14393
.Net SDK: 5.0.103
MSBUILD: 16.8.3+39993bd9d for .NET

@Sanan07
Copy link
Contributor

Sanan07 commented Mar 11, 2021

Limit by OS, not by TestPlatform

@Sanan07 Sanan07 closed this as completed Mar 11, 2021
@ch1seL
Copy link
Author

ch1seL commented Mar 12, 2021

Limit by OS, not by TestPlatform

Absolutely, but TestPlatform can import a huge filter from a file as an option to avoid restrictions.
For example, NUnit console runner support --testlist option to pass a list of tests as a file.
https://docs.nunit.org/articles/nunit/running-tests/Console-Command-Line.html#options

@rsaugier
Copy link

rsaugier commented Sep 20, 2021

Some people have very large test suites!
Being able to specify easily a large sub-set of tests to execute seems to be a valid use case to me (think of splitting for parallel execution).
This is not possible with this command-line restriction, neither with /Tests (which by the way specifies search patterns, not exact test method names) nor /TestCaseFilter ...
There might be a workarounds here but I think it's undocumented (added just for VS ?), so probably fragile...

A /TestCaseFilterFile:plaintext_file_with_list_of_filters.txt would be nice.

@nohwnd
Copy link
Member

nohwnd commented Mar 25, 2022

The solution linked above is stable, it is not just for VS: #2273 (comment)

Another option is using response files. They currently don't work with dotnet test and dotnet vstest, but work just fine for vstest.console. Tracking that bug here: #3513

@rsaugier
Copy link

Ok, great, Thanks @nohwnd for the clarification!

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

4 participants