Table of Contents

Class LocalTestProcess

Namespace
Xunit.v3
Assembly
xunit.v3.runner.utility.netfx.dll

Implementation of ITestProcess for a process running on the local machine.

public sealed class LocalTestProcess : ITestProcess, IDisposable
Inheritance
LocalTestProcess
Implements
Inherited Members

Properties

HasExited

Gets a flag to indicate whether the test process has exited or not yet.

public bool HasExited { get; }

Property Value

bool

ProcessID

Gets the process ID of the local process.

public int ProcessID { get; }

Property Value

int

StandardInput

Gets a TextWriter that can be used to write text from the standard input of the test process.

public TextWriter StandardInput { get; }

Property Value

TextWriter

StandardOutput

Gets a TextReader that can be used to read text from the standard output of the test process.

public TextReader StandardOutput { get; }

Property Value

TextReader

Methods

Attach(int, string?)

Returns a test process for an existing process based on process ID.

public static LocalTestProcess Attach(int processID, string? responseFile)

Parameters

processID int

The process ID

responseFile string

The response file (to be cleaned up during disposal)

Returns

LocalTestProcess

Cancel(bool)

Cancels the test pipeline, forcefully if necessary.

public void Cancel(bool forceCancellation)

Parameters

forceCancellation bool

When set to false, this should request graceful termination of the test pipeline; when set to true, the test process should be forcefully shut down as quickly as possible.

Remarks

Note that repeated calls to this method with forceCancellation set to false may be possible, since it may be dispatched every time a remote runner returns false from a message sink/message bus call. For out of process runners using Ctrl+C via standard input, it should only send Ctrl+C the first time this is called (since double Ctrl+C is the forceful cancellation signal).

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Start(string, string, string?)

Starts a new test process.

public static LocalTestProcess? Start(string executable, string executableArguments, string? responseFile)

Parameters

executable string

The executable to be launched

executableArguments string

The arguments to the executable

responseFile string

The response file (to be cleaned up during disposal)

Returns

LocalTestProcess

WaitForExit(int)

Wait for the specified number of milliseconds for the test process to exit.

public bool WaitForExit(int milliseconds)

Parameters

milliseconds int

The amount of time, in milliseconds, to wait

Returns

bool

Returns true if the process exited; false, otherwise