Open k15tfu opened 10 months ago
From the documentation for @FILE...
"Specifies the name (or path) of a FILE containing additional command-line arguments to be interpolated at the point where the @FILE expression appears. Each line in the file represents a separate command-line argument."
In this case, your aren't passing the full argument but only a part of it...
Instead try either of the following in your file...
--where test==/nunit_testfilter_csharp.Class1.Test("with spaces")/
--test /nunit_testfilter_csharp.Class1.Test("with spaces")/
The second line uses the --test
option rather than the --where
option.
Note that double quotes need to be escaped with a backslash on the command-line but not in the file. That's a feature. :-)
@CharliePoole Thank you for the quick response!
Instead try either of the following in your file...
The first line doesn't work either:
>TYPE ...\NunitWhereArg.txt
--where test==/nunit_testfilter_csharp.Class1.Test("with spaces")/
>...\tools\nunit3-console.exe ...\bin\Debug\nunit_testfilter_csharp.dll @...\NunitWhereArg.txt --noresult
NUnit Console 3.16.3 (Release)
Copyright (c) 2022 Charlie Poole, Rob Prouse
Tuesday, August 15, 2023 6:54:50 PM
Runtime Environment
OS Version: Microsoft Windows NT 6.2.9200.0
Runtime: .NET Framework CLR v4.0.30319.42000
Test Files
C:\p\test\nunit_testfilter_csharp\bin\Debug\nunit_testfilter_csharp.dll
spaces")/
System.ArgumentException : Illegal characters in path.
--ArgumentException
Illegal characters in path.
at System.IO.LongPathHelper.Normalize(String path, UInt32 maxPathLength, Boolean checkInvalidCharacters, Boolean expandShortPaths)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetFullPathInternal(String path)
at NUnit.Engine.TestPackage..ctor(String filePath)
at NUnit.Engine.TestPackage..ctor(IList`1 testFiles)
at NUnit.ConsoleRunner.ConsoleRunner.MakeTestPackage(ConsoleOptions options)
at NUnit.ConsoleRunner.ConsoleRunner.Execute()
at NUnit.ConsoleRunner.Program.Main(String[] args)
Each line in the file represents a separate command-line argument
This was my second question, if we are talking about command line parameters:
...\tools\nunit3-console.exe ...\bin\Debug\nunit_testfilter_csharp.dll --where "test==/nunit_testfilter_csharp.Class1.Test(\"with spaces\")/" --noresult
, I'd say --where
and test==/nunit_testfilter_csharp.Class1.Test("with spaces")/
are two separate arguments (not one), so in this case I should be able to pass only the latter argument via @FILE
but it also doesn't work.
I no longer work on the NUnit project, but it does look as if the particular expression --where test==...
may have a bug, which the @nunit/framework-team could address. I do know that --test...
has special code to handle double quotes used by NUnit in its test names.
WRT what is meant by an argument, I must admit that the docs could have been more specific. What each line represents is actuall a separate argument as handled internally by NUnit. Depending on how you write it, this may be a single command-line argument or two arguments. For example, compare --where cat=MyCategory
and --where:cat=MyCategory
.
Additionally, this handling will also vary between operating systems. Consider, for example that most Linux systems handle single quotes specially on the command-line while Windows doesn't. One of the ideas behind both @FILE
and --test-list=FILE
) was to provide a way of coding arguments that would work across different operating systems. As a result, the syntax differs from what is acceptable in any particular operating system.
Hi!
It turned out that
==
operator for test names with quotes or spaces cannot be passed via@FILE
, unlike the case when it is passed as command line arguments:and run with:
but it works when passing
--where
argument as parameters of a command line:NUnit Console 3.16.3 NUnit 3.13.3
Linked issues: https://github.com/nunit/nunit-console/issues/94, https://github.com/nunit/nunit-console/issues/1181.