Table of Contents

Class TeamCityReporter

Namespace
Xunit.Runner.Common
Assembly
xunit.v3.runner.common.dll

An implementation of IRunnerReporter that reports results to TeamCity. This is auto-enabled by the presence of the "TEAMCITY_PROJECT_NAME" environment variable.

public class TeamCityReporter : IRunnerReporter
Inheritance
TeamCityReporter
Implements
Inherited Members

Properties

CanBeEnvironmentallyEnabled

Gets a value which indicates if it's possible for this reporter to be environmentally enabled.

public bool CanBeEnvironmentallyEnabled { get; }

Property Value

bool

Remarks

Note that this differs from IsEnvironmentallyEnabled which checks to see whether the conditions currently exist to environmentally enable the reporter. This value is used when constructing the console runner help output that lists which runners might be environmentally enabled.

Description

Gets the description of the reporter. This is typically used when showing the user the invocation option for the reporter.

public string Description { get; }

Property Value

string

Gets a value which indicates whether this runner wishes to force no logo. Useful for runners which are designed for purely parseable output (for example, JsonReporter).

public bool ForceNoLogo { get; }

Property Value

bool

IsEnvironmentallyEnabled

Gets a value which indicates whether the reporter should be environmentally enabled.

public bool IsEnvironmentallyEnabled { get; }

Property Value

bool

Remarks

When a runner reporter is environmentally enabled in Microsoft Testing Platform CLI mode (or dotnet test), by default all realtime output is filtered except calls to LogRaw(string) (unless the user has specified the --xunit-info switch). Environmentally enabled reporters that require realtime console output (for example, to send formatted messages to a CI system which parses the console output) must use LogRaw(string) to ensure those messages will always be visible. All other messages will always be output to the Microsoft Testing Platform diagnostic logs, which are enabled via the --diagnostic switch.

RunnerSwitch

Gets a value which indicates a runner switch which can be used to explicitly enable the runner. If the return value is null, then the reported can only be environmentally enabled (implicitly). This value is used either as a command line switch (with the console or .NET CLI runner) or as a runner configuration value (with the MSBuild runner).

public string RunnerSwitch { get; }

Property Value

string

Remarks

Runner switches are only used in xUnit.net native CLI mode. When Microsoft Testing Platform CLI mode is enabled, reporters are only supported via environmental enablement, since MTP generally controls all the normal output.

Methods

CreateMessageHandler(IRunnerLogger, IMessageSink?)

Creates a message handler that will report messages for the given test assembly.

public ValueTask<IRunnerReporterMessageHandler> CreateMessageHandler(IRunnerLogger logger, IMessageSink? diagnosticMessageSink)

Parameters

logger IRunnerLogger

The logger used to send result messages to

diagnosticMessageSink IMessageSink

An optional message sink that diagnostic messages can be sent to.

Returns

ValueTask<IRunnerReporterMessageHandler>

The message handler that handles the messages