Skip to content

Modifications to TestPackage API - #18

Merged
CharliePoole merged 1 commit into
mainfrom
issue-17
Oct 11, 2026
Merged

CharliePoole merged 1 commit into
mainfrom
issue-17

Conversation

@CharliePoole

Copy link
Copy Markdown
Member

Fixes #17

@manfred-brands manfred-brands left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good

What is the use case to have both AddSettings and ApplySettings?

@CharliePoole

Copy link
Copy Markdown
Member Author

After the runner initializes, various settings will exist in the tree of packages -- which is generally the top part of the tree of tests, down to the level of assemblies. The packages will have a number of settings, some propagated to all packages, some unique to a particular level. Other settings, where needed, will end up taking on their default values.

If the runner provides a UI to make changes to parts of the tree -- either for a run or to be saved -- then ApplySetting can be used. AddSetting OTOH is most useful upon iniitialization, when we already know that no other settings are present in lower parts of the tree.

Of course, the console runner has no need of this. It initializes, runs and exits. The TestCentric GUIJ does it extensively and I believe the adapter may be able to use it in a few places.

@CharliePoole
CharliePoole merged commit 3f69eeb into main Oct 11, 2026
3 checks passed
@CharliePoole
CharliePoole deleted the issue-17 branch October 11, 2026 14:38
@CharliePoole

Copy link
Copy Markdown
Member Author

@nunit/engine-team @OsirisTerje

Ran into a problem tagging this as a new release. Please chime in on nunit/nunit-console#1908

@manfred-brands

Copy link
Copy Markdown
Member

AddSetting OTOH is most useful upon iniitialization, when we already know that no other settings are present in lower parts of the tree.

But if there are no existing settings, Add is the same as Apply.

@CharliePoole

CharliePoole commented Oct 12, 2026 •

Copy link
Copy Markdown
Member Author

Yes, exactly so. But the calling code would have to descend the tree of packages and decide at each step whether to use Add or Set. ApplySetting abstracts that process. Of course, we could just use ApplySetting all the time but then we might be silently overwriting values that we shouldn't overwrite.

@manfred-brands

Copy link
Copy Markdown
Member

Hence my question why do we need Add if Set adds if necessary.

@CharliePoole

Copy link
Copy Markdown
Member Author

As I said... we could conceivably do without it, but the exception may be of use in some cases, And I think which one is used at any point provides a statement of intent that makes the code easier to understand. It's a judgement call.

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

Successfully merging this pull request may close these issues.

Improvement / Standardization of PackageSetting and TestPackage APIs

2 participants