nunit-console: In nunit3-console you cannot pass parameters containing ';' because they always get splitted
@SilverXXX commented on Fri Jul 22 2016
When running some tests with nunit3-console.exe, if you pass with --param there is no way to pass inside a value a ‘;’.
It seems from CommandLineOptions.cs the you can’t escape them in any way (it’s not documented so i read the source directly). A regex to capture only not escaped char would solve the problem (i’m not a regex expert so i cant suggest exact one)
@rprouse commented on Fri Jul 22 2016
See our docs, there is general information there on quoting for various operating systems. You can also have multiple --param in the command line, one per variable.
I am closing this as a question, but feel free to add questions, we will see them and try to help.
@ChrisMaddock commented on Fri Jul 22 2016
@rprouse - I think this is a potential ‘issue’ within NUnit, not command line usage? Looks like the options will always split on semi-colon, and then throw if it’s not a valid A=B format afterwards? So I don’t think there is any way pass in a test parameter with a semi-colon currently. (If that’s to be a supported thing to do!)
@SilverXXX commented on Fri Jul 22 2016
Yes @ChrisMaddock, i would have tried to create a pull request to show a possible solution, it actually require only a one line change and a sensible regexp, but i’m quite bad at it (a connection string is a simple example of an impossible paramater to pass right now) Edit: and since it’s all made of key=value it doesnt even return an error
@rprouse commented on Fri Jul 22 2016
Sorry, reading issues on my phone, I missed the detail 😦
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 50 (34 by maintainers)
Commits related to this issue
- Merge pull request #23 from nunit/license Update the license — committed to nunit/nunit-console by CharliePoole 7 years ago
I think
--testparamor-runparamwould be fine.To the whole not breaking the API and SemVer, I think it is a nice ideal and we shouldn’t introduce subtle hard to diagnose behavior changes, but I think we should be free to break things in obvious ways in order to fix things. To me, incrementing the version to 4.0 to do that isn’t realistic or practical and I don’t think the majority of ‘dark matter’ developers even realize the significance of it. If our experience moving from 2.x to 3.x is anything, developers will still complain that you moved their cheese even if you’re yelling the breaking changes to the world 😄
I find these long back and forth discussions a bit overwhelming and hard to keep track of especially for such a small issue. We have enough work keeping up without adding to it ourselves.
@jnm2 Quite confusing, I’d say!
I’m not sure that such a feature would be any easier than what we can do already. Plus, we would still have to handle all other (non NUnit 3) frameworks differently. Better to have one approach that works for all. Seems to me that the concept of a driver is what gives us the capability to “recognize” and give an error for anything the framework we are driving won’t handle. The driver is the only part of the engine that knows what framework it is using and what it is capable of.
@jnm2 Note that you can’t use
-rp, as that would be equivalent to-r -p. It would have to be--rp, just as you do withgit merge master --ff. This is a linux/unix standard that has been adopted by many cross-platform programs and is enforced inOptions.cs.What you say about the command-line as API is correct, in the strictest sense. But we have never been very strict about it in the past, having changed our definition of command-line options many times without a qualm. The fact is that such a change on our part requires a lot less effort for users to respond to than a change in how an assertion or an attribute works.
I’m not convinced that strict adherence to definitions is always useful. I guess “What’s most useful at this moment?” would be my guideline rather than “What constitutes an API?”
I do think this stuff needs to be discussed, so thank you for that.
Regarding frameworks… NUnit has generally been able to work with all it’s older frameworks over many years. Each 2.x runner worked with all preceding frameworks for many years. and then many years more with all 2.x frameworks. NUnit 3.x continues to work with 2.x, through an extension.
However, in the past, the assumption was that major releases only happened every decade or more. Since you are talking about 4.0 coming out soon, then I don’t think it can be the big bang change that we had with 3.0. All this is covered in our Vision document, but may not be spelled out as well as it should be. It will be up to you guys (Core Team) after I leave to decide if you want to change the Vision and Values of NUnit, but IMO you should formally change them before you act on those changes. Up to now, our goal has been that no user has to recompile using a new framework in order to use a new runner, although they may want to in order to use new features.
I wonder if we should introduce
--runparamsor something with the new behaviour, and deprecate--params. The console could show a warning whenever--paramsis used, and we could remove it in a future release. That would provide a clean ‘upgrade path’ for people - the only issue is that we end up with a slightly less sensible command line argument.--runparamswould then error with pre-3.5 frameworks.I’ve removed the easyfix label from this - I think it’s anything but! 😄
PR #155 did not fix this issue but was closed automatically because it contained the comment “Fixes #23”
As indicated by its title, PR #155 removed parameter parsing from the framework and made it the responsibility of the runner. Additionally, as part of the change, we started using a dictionary rather than a string to represent parameters. The intent was to make it easier to subsequently fix the problem called out by this issue.
There have been various views of backward compatibility raised here. For the record, my own is that there is never a backward compatibility problem when something broken is fixed. Of course, there can always be somebody who came to rely on the broken implementation, but frankly that’s there own fault. In this case, the only risk to worry about is if we use a non-standard escaping mechanism, which would not be known in advance to users. Let’s not do that!
I’m re-opening this issue.