-
Notifications
You must be signed in to change notification settings - Fork 30
Fix applying package settings #1409
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
Conversation
|
So far the setting dialog stores a dictionary <string, object> for the package settings. Now we use a list of PackageSetting objects instead to prevent boxing of value types. The PackageSetting objects are created explicitly in method |
|
One benefit of using PackSetting objects is that it allows us to call TestPackage.AddSetting(TestPackage). This method applies a setting to all subpackages, so we don't need to perform this task on our own. However, please notice the new keyword - additional to the implementation in class TestPackage we need to set the IsDirty flag. |
|
I did one additional code clean-up: I spotted also the two command line options: And one last remark: we could rename the existing method TestCentricProject.AddSetting(...) to SetTopLevelSetting(...). And maybe use also a PackageSetting as parameter instead of (string, object)? Just to avoid this confusion in future. |
CharliePoole
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline comment regarding AddSettings usage.
| { | ||
| Model.TestCentricProject?.AddSetting(entry.Key, entry.Value); | ||
| Model.TestCentricProject?.RemoveSetting(setting.Name); | ||
| Model.TestCentricProject?.AddSetting(setting); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use of AddSettings here suggests that we have information that any setting included in the dialog pages is intended to be set on every subpackage. But we have no guarantee that this is true and even if it is true today, new settings may not meet this criterion.
After going through the code carefully, I can see that this is not a change you introduced but that the code always made this assumption.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking through the settings, my conclusions are as follows...
General Tab - all settings should be top level only. That is, they only appear on the test project itself since they only relate to the GUI.
Tree Display Tab - also all top level only.
Assembly Load Settings Tab - These may be removed as we discussed, but while we have them they should work correctly. These settings differ. Specificallty...
- Agent Limit has to be top level as our algorithm does not allow separate limits per subpackage.
- Shadow Copy and Principal policy could vary by assembly in theory, but we don't support that. However, the values currently need to be promulgated to each assembly so that the agent executing tests can see them.
Automatic Reload Tab - Top Level Only
Project Editor Tab - Top Level Only
So, in summary, most settings are top-level only. Could we keep two lists, one for top-level settings and one for per-assembly settings?
|
Regarding some of your questions...
Let me know if I missed anything, but everything looks great if we can distinguish the two sorts of settngs in our behavior. FWIW, I don't think the user needs to know whether we promulgate the settings so long as it all works. |
|
Good suggestions - I've incorporated the code review comments:
|
|
And regarding these two "simulate-unload..." settings, I finally spotted their usage in our TestCentric.Agent.Core code base. But since we don't use that one anymore and these settings are also not used in the NUnit code base, I decided to clean it up and remove them. |
|
I'm going to merge this PR now, so that I can continue with the related task (#1408). Nonetheless I can add additional changes afterwards if requested. |
This PR fixes #1407. Although the issue description sounds like a UI update issue, it turned out that the package settings were not properly applied.
The solution consist of two important parts:
PackageSettingobjects instead of <string, object> pairs to apply a settingTestPackage.AddSetting(TestPackage)instead of methodSettings.Set(key, value)The first part helps to avoid boxing of value types - so that a bool value if properly set as a bool type and not of type object(bool).
The second part is necessary so that that a setting is not only applied as a top-level setting, but applied also to all subpackages.
The package setting sub view, in turn, requests the values directly from the subpackages, so it will display the changed values right away.
Some further details are described in the next comments.