Skip to content

Add settings for requesting and reporting an agent type - #27

Merged
CharliesDevBot merged 1 commit into
mainfrom
issue-1983
Dec 3, 2026
Merged

CharliesDevBot merged 1 commit into
mainfrom
issue-1983

Conversation

@CharliesDevBot

Copy link
Copy Markdown
Collaborator

Part of nunit/nunit-console#1983. A runner can ask for an agent by name, but not for a kind of agent, so the console asks for the in-process agent by an internal name it must keep in step with the engine.

Changes

  • SettingDefinitions.RequestedAgentType, beside RequestedAgentName. A runner sets it to ask for a kind of agent.
  • SettingDefinitions.SelectedAgentType, beside SelectedAgentName. The engine sets it to report the kind of agent it used.

Both are strings holding the name of a TestAgentType member (InProcess, LocalProcess or RemoteProcess), and default to empty. They aren't enum-valued because package settings with enum values aren't serialized today. The doc comment on RequestedAgentType says that tests still run in-process only when that is asked for.

Tests

A new test checks that both settings can be looked up by name, are strings, and default to empty. All 74 tests pass on net462 and net8.0.

Follow-up

The engine and console side is a separate nunit/nunit-console PR, which will pin the MyGet build containing this change. It covers how the engine chooses an agent by type, what happens when a requested name and type don't match, and the console's --inprocess option.

This PR is the first in a trial of Claude working through a bot account, described on nunit/nunit-console#1983.

🤖 Generated with Claude Code

Add SettingDefinitions.RequestedAgentType and SelectedAgentType, beside
RequestedAgentName and SelectedAgentName. Runners can then ask for a kind
of agent, such as InProcess, without knowing an agent's internal name,
and see which kind the engine used.

Values are the names of TestAgentType members, held as strings because
PackageHelper does not serialize enum-valued settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CharliesDevBot

Copy link
Copy Markdown
Collaborator Author

@dotnet-policy-service agree

@CharliePoole CharliePoole 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.

This looks good to me. Most of the work will be in the console and engine changes.

/// of a <see cref="TestAgentType"/> member.
/// </summary>
public static SettingDefinition<string> SelectedAgentType { get; } = new(nameof(SelectedAgentType), string.Empty);

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.

I like the symmetry of the names with the two agent name settings.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks. That was the aim: each type setting sits beside the name setting it pairs with, so a runner can read them together.

@CharliesDevBot
CharliesDevBot merged commit f16b919 into main Dec 3, 2026
2 checks passed
@CharliesDevBot
CharliesDevBot deleted the issue-1983 branch December 3, 2026 00:22
@CharliePoole CharliePoole added this to the 4.0.0-beta.102 milestone Dec 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants