Class OpenApiCoverageCollector

Namespace
ProtoTest.OpenApi
Assembly
ProtoTest.OpenApi.dll

Collects OpenAPI coverage from REST responses and shape matches: the route matcher resolves each hit to a contract path, the typed ledger counts it, and the report builder renders the contract's endpoints, responses and properties whether or not they were hit. A source that is a path on the application (/openapi/v1.json) with no address to resolve it against loads from the application once the run's infrastructure started, so an in-process application documents itself.

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

Constructors

OpenApiCoverageCollector(string, IConfiguration, IEnumerable<ProtoApplicationTarget>)

public OpenApiCoverageCollector(string targetName, IConfiguration configuration, IEnumerable<ProtoApplicationTarget> applicationTargets)

Parameters

targetName string
configuration IConfiguration
applicationTargets IEnumerable<ProtoApplicationTarget>

OpenApiCoverageCollector(string, string)

public OpenApiCoverageCollector(string targetName, string openApiSpecSource)

Parameters

targetName string
openApiSpecSource string

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>