GreenMoose;10174 wrote:
* Using /e "Manual" without existing .v3.ncrunchsolution and without /c, causes NCrunch to execute all tests.
If there is no "Manual" engine mode in your global config file at C:\Users\USER\AppData\Roaming\NCrunch\globalconfig.crunch.v3.xml, then the current design is for the engine to behave this way (as 'Manual' doesn't exist).
GreenMoose;10174 wrote:
* Renaming .v3.ncrunchsolution => e.g. .v3.ncrunchsolution.bak and supply that with /c, also works when using along with /e "Manual".
* Invoking ncrunch.exe with a csproj file, using /c .v3.ncrunchsolution, also works when using along with /e "Manual".
This works because NCrunch is then parsing the .v3.ncrunchsolution file as a global config file. The XML structure of the global config file is very similar to the solution one, so NCrunch picks up the engine modes declared in this file and runs with them. Using the console tool this way is not recommended.
GreenMoose;10174 wrote:
* I have an old NCrunch grid node installed, thus also AppData\Roaming\NCrunch\globalconfig.ncrunch.xml, which NCrunch uses if no specific config is specified.
The grid nodes will always store their configuration in the registry. This is because they often run under the local system account, and other user accounts need to be able to configure them. The console tool will still use the above config file as its default global config file (actually, it will use a .v3, but will still port settings from the old file if no .v3 file exists).
GreenMoose;10174 wrote:
* If using multiple /c switches, only the last one is in effect.
This makes sense, as NCrunch can only use one global config file at a time.
GreenMoose;10174 wrote:
Questions:
* If I understand it correctly, NCrunch merges 5 levels of config settings: 1) app default 2) globalconfig.ncrunch.xml, 3) v3.ncrunchsolution, 4) /c param, 5) -<setting> params ? And settings to right overrides settings to the left?
Not necessarily. Although there is a configuration inheritance structure in the form: Default->Global->Solution->Project with engine modes and console parameters overriding, there can only ever be one source of global configuration. When the /C parameter is used, you are specifying this config file. Otherwise, the global config file is C:\Users\USER\AppData\Roaming\NCrunch\globalconfig.crunch.v3.xml. You could basically consider /C as just being a switch to tell NCrunch to use a different global config file. When you use this parameter, the global config file at C:\Users\USER\AppData\Roaming\NCrunch\globalconfig.crunch.v3.xml is not read by NCrunch.
So /C actually isn't considered at all in the merging/inheritance of config settings.
GreenMoose;10174 wrote:
Comments:
* It would be useful if there is an option to fail on not found engine mode supplied with /e, instead of silently ignoring it which execute all tests (which in my case is very undesirable since that includes system tests that are meant to only run at a later phase in the build chain).
Agreed. It seems better to have the tool bug out than try to pretend nothing went wrong. I've noted this down for review.
GreenMoose;10174 wrote:
The best approach for now for me is probably to:
Step 1 (local tests, building All.sln): Parse the v3.ncrunchsolution, ensuring the requested engine mode is part of it, and only then invoke ncrunch.exe with /e ... and -<setting> params to define workspace/cache paths, which then executes non system tests (and expect exit code 5).
Step 2 (system tests, building sysTests.csproj): Same parse logic as step 1, invoke ncrunch.exe with the csproj system test project /e ... and /c v3.ncrunchsolution in order to get the engine mode definitions and -<setting> to define workspace/cache paths.
It's hard for me to give solid advise on the best plan for you here without knowing everything involved, but I might be able to suggest another approach here that involves less complexity.
As part of V3, the console tool parameter handling was upgraded so that you can override almost any global or solution-level configuration setting using the command line, including the TestsToExecuteAutomatically setting.
For example, the following command line should work if you want the effects of the default 'Run all tests manually' engine mode:
ncrunch.exe mysolution.sln -TestsToExecuteManually "False"
Using this, there is no need for you to use dynamic engine modes. You just look at what the engine mode does, and pass this straight into the console tool. The setting names and values should in most cases be the same as they are when declared in the XML; the only exception is in when specifying lists of values (which use <Value>xyz</Value> in the XML), which are delimited by semicolons, i.e. -Capabilities "Capability1;Capability2".
GreenMoose;10174 wrote:
*Edit: Thus there is no issue with <Settings />, I verified that as well.
Thanks :)