Class RestTrafficCoverageCollector

Namespace
ProtoTest.Rest
Assembly
ProtoTest.Rest.dll

Reports the fields that arrived in REST responses but that no shape assertion mentioned, as their own report section. Observed fields are never counted as covered: the section protects the assertion-level coverage rule and shows the fields a passing suite never checked. Register it on a REST target (AddCollector<RestTrafficCoverageCollector>()) to opt in.

public sealed class RestTrafficCoverageCollector : ProtoCoverageCollector, IProtoCollector, IProtoReportSource
Inheritance
RestTrafficCoverageCollector
Implements
Inherited Members
Extension Methods

Remarks

The collector consumes the run's response and shape observations. Response bodies are the sanitized bodies the trace already carries, so a body truncated by the diagnostic cap cannot be analyzed and contributes nothing; a shape assertion made without a context records no structured route and is ignored. Fields are compared per method, route template and status code, and a field any shape mentioned counts as asserted for the run.

Constructors

RestTrafficCoverageCollector(string)

Reports the fields that arrived in REST responses but that no shape assertion mentioned, as their own report section. Observed fields are never counted as covered: the section protects the assertion-level coverage rule and shows the fields a passing suite never checked. Register it on a REST target (AddCollector<RestTrafficCoverageCollector>()) to opt in.

public RestTrafficCoverageCollector(string targetName)

Parameters

targetName string

Remarks

The collector consumes the run's response and shape observations. Response bodies are the sanitized bodies the trace already carries, so a body truncated by the diagnostic cap cannot be analyzed and contributes nothing; a shape assertion made without a context records no structured route and is ignored. Fields are compared per method, route template and status code, and a field any shape mentioned counts as asserted for the run.

Properties

Category

public override string Category { get; }

Property Value

string

Methods

CanCollect(ProtoObservation)

Determines whether this collector accepts an observation.

public override bool CanCollect(ProtoObservation observation)

Parameters

observation ProtoObservation

Returns

bool

Collect(ProtoObservation)

Records an incoming observation. Implementations should support concurrent calls when tests or requests execute in parallel.

public override void Collect(ProtoObservation observation)

Parameters

observation ProtoObservation

GetReportItems()

public override IEnumerable<ProtoReportItem> GetReportItems()

Returns

IEnumerable<ProtoReportItem>