Class LocalTestProcess
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
ProcessID
Gets the process ID of the local process.
public int ProcessID { get; }
Property Value
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
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
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
processIDintThe process ID
responseFilestringThe response file (to be cleaned up during disposal)
Returns
Cancel(bool)
Cancels the test pipeline, forcefully if necessary.
public void Cancel(bool forceCancellation)
Parameters
forceCancellationboolWhen set to
false, this should request graceful termination of the test pipeline; when set totrue, 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
executablestringThe executable to be launched
executableArgumentsstringThe arguments to the executable
responseFilestringThe response file (to be cleaned up during disposal)
Returns
WaitForExit(int)
Wait for the specified number of milliseconds for the test process to exit.
public bool WaitForExit(int milliseconds)
Parameters
millisecondsintThe amount of time, in milliseconds, to wait
Returns
- bool
Returns
trueif the process exited;false, otherwise