Interface IProtoTraceWriter

Namespace
ProtoTest.Core
Assembly
ProtoTest.Core.dll

Records automatic execution operations and events. This API primarily exists for ProtoTest integrations.

public interface IProtoTraceWriter
Extension Methods

Methods

Attachment(string, string, string?)

Records an attachment; the artifact file itself is captured with the test's artifacts.

void Attachment(string name, string mediaType, string? description = null)

Parameters

name string
mediaType string
description string

CaptureActivity(Activity)

Captures a span from a watched activity source into the trace. Its tags become attributes, its status becomes the outcome, and its timing is preserved. This is how an application's own instrumentation reaches the run without depending on ProtoTest. Returns the id of the recorded operation so callers can link state to it.

string? CaptureActivity(Activity activity)

Parameters

activity Activity

Returns

string

Finding(string, string, string, string?, IReadOnlyList<string>?, IReadOnlyDictionary<string, object>?)

Records evidence worth reporting that is deliberately not a failure.

void Finding(string message, string status, string category, string? targetName = null, IReadOnlyList<string>? tags = null, IReadOnlyDictionary<string, object>? metadata = null)

Parameters

message string
status string
category string
targetName string
tags IReadOnlyList<string>
metadata IReadOnlyDictionary<string, object>

Observation(string, string, string, string?, string?)

Records a semantic fact the test emitted on purpose; it belongs to the record axis.

void Observation(string targetName, string kind, string identifier, string? data = null, string? metadata = null)

Parameters

targetName string
kind string
identifier string
data string
metadata string

SetEntityState(string, string, string, IReadOnlyDictionary<string, string?>?, string?, string?)

Records the current state of an entity, merging the fields into what is already known. Each call also appends a version, so a context that was set and later replaced keeps its history. State is recorded once per entity, not per call: entries refer to the entity instead of repeating it.

void SetEntityState(string kind, string id, string name, IReadOnlyDictionary<string, string?>? state = null, string? scope = null, string? change = null)

Parameters

kind string
id string
name string
state IReadOnlyDictionary<string, string>
scope string
change string

StartOperation(string, string, string, ProtoTracePhase, IReadOnlyDictionary<string, string?>?, string?, string?, string?)

ProtoTraceOperation StartOperation(string kind, string name, string source, ProtoTracePhase phase = ProtoTracePhase.Execution, IReadOnlyDictionary<string, string?>? attributes = null, string? parentId = null, string? entityKind = null, string? entityId = null)

Parameters

kind string
name string
source string
phase ProtoTracePhase
attributes IReadOnlyDictionary<string, string>
parentId string
entityKind string
entityId string

Returns

ProtoTraceOperation

Value(string, string, string, string, IReadOnlyDictionary<string, string?>?, ProtoTraceValueSource, bool, string?, string?)

Records a value version: a domain object was created, changed, read or deleted. Versions accumulate on the value, and the version carries the operation that produced it.

void Value(string kind, string id, string name, string change, IReadOnlyDictionary<string, string?>? state = null, ProtoTraceValueSource source = ProtoTraceValueSource.TestSide, bool inferred = false, string? scope = null, string? operationId = null)

Parameters

kind string
id string
name string
change string
state IReadOnlyDictionary<string, string>
source ProtoTraceValueSource
inferred bool
scope string
operationId string

WriteEvent(string, string, string, ProtoTracePhase, ProtoTraceOutcome, IReadOnlyDictionary<string, string?>?, Exception?, string?, string?, string?)

Records an event. Identical error-free events written under the same parent collapse into one entry with a Count in the trace, so a fact repeated on every call costs one row with a number instead of one row per call. Failures always stay separate.

void WriteEvent(string kind, string name, string source, ProtoTracePhase phase = ProtoTracePhase.Execution, ProtoTraceOutcome outcome = ProtoTraceOutcome.Unknown, IReadOnlyDictionary<string, string?>? attributes = null, Exception? exception = null, string? parentId = null, string? entityKind = null, string? entityId = null)

Parameters

kind string
name string
source string
phase ProtoTracePhase
outcome ProtoTraceOutcome
attributes IReadOnlyDictionary<string, string>
exception Exception
parentId string
entityKind string
entityId string