-
Notifications
You must be signed in to change notification settings - Fork 1
Integration StorageQueues Extension
The Kronikol.Extensions.StorageQueues package adds Azure Storage Queue operation tracking to your test diagrams. Instead of showing raw HTTP requests like POST /my-queue/messages, your sequence diagrams show classified operations like Send → my-queue or Receive ← my-queue.
Using a shared library or abstraction layer? If your code doesn't use the Storage Queues SDK directly — e.g. it goes through MassTransit, a shared messaging library, or a custom abstraction — see the MassTransit Extension or Tracking Custom Dependencies for alternative approaches including
MessageTrackerandTrackingProxy<T>.
The Azure Storage Queues SDK translates all operations into HTTP requests to the Azure Storage REST API. StorageQueueTrackingMessageHandler is a DelegatingHandler that intercepts these HTTP requests, classifies each one into a Queue operation (SendMessage, ReceiveMessages, PeekMessages, DeleteMessage, etc.) using the HTTP method, URL path, and query parameters, then logs it to RequestResponseLogger with a human-readable label.
Because it logs to the same RequestResponseLogger as the standard TestTrackingMessageHandler, Storage Queue operations appear alongside your HTTP API calls in the same sequence diagram — showing the complete flow from test → API → Storage Queue.
dotnet add package Kronikol.Extensions.StorageQueuesThe extension supports three verbosity levels that control how much detail appears in the diagrams:
| Level | Method shown | URI shown | Headers | Request body | Response body |
|---|---|---|---|---|---|
| Raw | HTTP method (POST, GET, etc.) |
Full URI with query parameters | All except excluded set | Full content | Full content |
| Detailed | Classified label (Send → my-queue) |
Clean URI (storagequeue:///my-queue) |
Filtered (noisy Storage headers excluded) | Full content | Full content |
| Summarised | Operation name (SendMessage) |
Clean URI (storagequeue:///my-queue) |
None | None | None |
The default is Detailed.
| Operation | Raw | Detailed | Summarised |
|---|---|---|---|
| Send message | POST: .../my-queue/messages |
Send → my-queue |
SendMessage |
| Receive messages | GET: .../my-queue/messages |
Receive ← my-queue |
ReceiveMessages |
| Peek messages | GET: .../my-queue/messages?peekonly=true |
Peek ← my-queue |
PeekMessages |
| Delete message | DELETE: .../my-queue/messages/msg-id |
Delete |
DeleteMessage |
| Update message | PUT: .../my-queue/messages/msg-id |
Update |
UpdateMessage |
| Clear messages | DELETE: .../my-queue/messages |
Clear → my-queue |
ClearMessages |
| Create queue | PUT: .../my-queue |
CreateQueue |
CreateQueue |
| Delete queue | DELETE: .../my-queue |
DeleteQueue |
DeleteQueue |
| Get properties | GET: .../my-queue?comp=metadata |
GetProperties |
GetProperties |
| Set metadata | PUT: .../my-queue?comp=metadata |
SetMetadata |
SetMetadata |
| List queues | GET: /?comp=list |
ListQueues |
ListQueues |
The classifier recognises these Storage Queue operations from the SDK's HTTP traffic:
| Operation | HTTP Pattern |
|---|---|
SendMessage |
POST /{queue}/messages |
ReceiveMessages |
GET /{queue}/messages |
PeekMessages |
GET /{queue}/messages?peekonly=true |
DeleteMessage |
DELETE /{queue}/messages/{messageId} |
UpdateMessage |
PUT /{queue}/messages/{messageId} |
ClearMessages |
DELETE /{queue}/messages |
CreateQueue |
PUT /{queue} |
DeleteQueue |
DELETE /{queue} |
GetProperties |
GET /{queue}?comp=metadata |
SetMetadata |
PUT /{queue}?comp=metadata |
ListQueues |
GET /?comp=list |
Other |
Unrecognised requests |
In Summarised mode, Other operations are silently skipped.
var trackingOptions = new StorageQueueTrackingMessageHandlerOptions
{
ServiceName = "StorageQueue",
CallerName = "My API",
Verbosity = StorageQueueTrackingVerbosity.Detailed,
CurrentTestInfoFetcher = CurrentTestInfo.Fetcher
};
var clientOptions = new QueueClientOptions();
clientOptions.WithTestTracking(trackingOptions);
var client = new QueueServiceClient(connectionString, clientOptions);WithTestTracking sets the Transport property on QueueClientOptions to route all HTTP requests through the tracking handler.
If you need more control over the HTTP pipeline:
var trackingOptions = new StorageQueueTrackingMessageHandlerOptions
{
ServiceName = "StorageQueue",
CallerName = "My API",
Verbosity = StorageQueueTrackingVerbosity.Detailed,
CurrentTestInfoFetcher = CurrentTestInfo.Fetcher
};
var trackingHandler = new StorageQueueTrackingMessageHandler(trackingOptions);
var httpClient = new HttpClient(trackingHandler);
var transport = new Azure.Core.Pipeline.HttpClientTransport(httpClient);
var clientOptions = new QueueClientOptions
{
Transport = transport
};
var client = new QueueServiceClient(connectionString, clientOptions);builder.ConfigureTestServices(services =>
{
services.AddSingleton(sp =>
{
var trackingOptions = new StorageQueueTrackingMessageHandlerOptions
{
ServiceName = "StorageQueue",
CallerName = "My API",
Verbosity = StorageQueueTrackingVerbosity.Detailed,
CurrentTestInfoFetcher = CurrentTestInfo.Fetcher
};
var clientOptions = new QueueClientOptions();
clientOptions.WithTestTracking(trackingOptions);
return new QueueServiceClient("UseDevelopmentStorage=true", clientOptions);
});
});| Property | Type | Default | Description |
|---|---|---|---|
ServiceName |
string |
"StorageQueue" |
The participant name shown in the diagram for the Storage Queue service |
CallerName |
string |
"Caller" |
The participant name shown for the service making Queue calls |
Verbosity |
StorageQueueTrackingVerbosity |
Detailed |
Controls how much detail appears in the diagram (Raw, Detailed, Summarised) |
CurrentTestInfoFetcher |
Func<(string Name, string Id)>? |
null |
Returns the current test's name and ID. Required — if null, requests are forwarded but not logged |
CurrentStepTypeFetcher |
Func<string?>? |
null |
Optional — returns the current BDD step type (Given/When/Then) |
HttpContextAccessor |
IHttpContextAccessor? |
null |
Optional — enables dual-resolution of test identity from HTTP headers. Auto-resolved by DI extensions (v2.26.3+). See HTTP Tracking Setup#Dual-Resolution Test Identity (v2.23.0+) |
v2.23.0+ Dual-Resolution:
StorageQueueTrackingMessageHandleraccepts an optionalIHttpContextAccessor? httpContextAccessorconstructor parameter for resolving test identity from HTTP request headers when running inside the SUT's request pipeline. v2.26.3+: SetHttpContextAccessoronStorageQueueTrackingMessageHandlerOptionsinstead — the tracker reads it automatically. See HTTP Tracking Setup#Dual-Resolution Test Identity (v2.23.0+) for details. |ExcludedHeaders|HashSet<string>| See below | Headers to exclude from diagrams in Raw/Detailed mode | |SetupVerbosity|StorageQueueTrackingVerbosity?|null| Verbosity override for the Setup phase. See Phase-Aware Tracking | |ActionVerbosity|StorageQueueTrackingVerbosity?|null| Verbosity override for the Action phase. See Phase-Aware Tracking | |TrackDuringSetup|bool|true| Whenfalse, tracking is suppressed during Setup. See Phase-Aware Tracking | |TrackDuringAction|bool|true| Whenfalse, tracking is suppressed during Action. See Phase-Aware Tracking |
The following Azure Storage headers are excluded by default (they add noise without diagnostic value):
Authorizationx-ms-datex-ms-versionx-ms-client-request-idx-ms-return-client-request-idUser-AgentCache-Control
Override ExcludedHeaders to customise:
new StorageQueueTrackingMessageHandlerOptions
{
ExcludedHeaders = ["Authorization", "x-ms-date"] // Only exclude these two
}Every framework package provides a CurrentTestInfo static class with a Fetcher property. The syntax is identical regardless of framework - just ensure you have the correct using directive:
CurrentTestInfoFetcher = CurrentTestInfo.Fetcher| Framework |
using directive |
|---|---|
| xUnit v3 | using Kronikol.xUnit3; |
| xUnit v2 | using Kronikol.xUnit2; |
| NUnit 4 | using Kronikol.NUnit4; |
| MSTest | using Kronikol.MSTest; |
| TUnit | using Kronikol.TUnit; |
| LightBDD | using Kronikol.LightBDD; |
| ReqNRoll | using Kronikol.ReqNRoll; |
| BDDfy | using Kronikol.BDDfy.xUnit3; |
public static QueueClientOptions WithTestTracking(
this QueueClientOptions options,
StorageQueueTrackingMessageHandlerOptions trackingOptions,
HttpMessageHandler? innerHandler = null)Configures QueueClientOptions to use StorageQueueTrackingMessageHandler. Sets options.Transport to an HttpClientTransport backed by an HttpClient wrapping the tracking handler. The optional innerHandler parameter sets the inner handler (defaults to HttpClientHandler).
StorageQueueTrackingMessageHandler implements ITrackingComponent and auto-registers with TrackingComponentRegistry on construction. At report generation time, unused components are automatically detected and surfaced as console warnings and in the diagnostic report (when DiagnosticMode=true). This never throws or fails tests.
See Diagnostics and Debugging for full details on the TrackingComponentRegistry API.
Getting Started
Common Tasks
Integration Guides
- Integration xUnit3
- Integration xUnit2
- Integration NUnit
- Integration MSTest
- Integration TUnit
- Integration BDDfy xUnit3
- Integration LightBDD xUnit2
- Integration LightBDD xUnit3
- Integration LightBDD TUnit
- Integration ReqNRoll xUnit2
- Integration ReqNRoll xUnit3
- Integration ReqNRoll TUnit
Extensions
- Integration AtlasDataApi Extension
- Integration BigQuery Extension
- Integration Bigtable Extension
- Integration BlobStorage Extension
- Integration ClickHouse Extension
- Integration CloudStorage Extension
- Integration CosmosDB Extension
- Integration Dapper Extension
- Integration DynamoDB Extension
- Integration EF Core Relational Extension
- Integration Elasticsearch Extension
- Integration EventBridge Extension
- Integration EventHubs Extension
- Integration Grpc Extension
- Integration Kafka Extension
- Integration MassTransit Extension
- Integration MongoDB Extension
- Integration MySqlConnector Extension
- Integration Npgsql Extension
- Integration Oracle Extension
- Integration PubSub Extension
- Integration Redis Extension
- Integration S3 Extension
- Integration ServiceBus Extension
- Integration SNS Extension
- Integration Spanner Extension
- Integration SqlClient Extension
- Integration Sqlite Extension
- Integration SQS Extension
- Integration StorageQueues Extension
- Integration OpenTelemetry Extension
- Integration DispatchProxy Extension
- Integration MediatR Extension
- Integration PlantUML IKVM
Configuration
- Tracking Dependencies
- Tracking Custom Dependencies
- HTTP Tracking Setup
- Report Configuration
- Diagram Customisation
- Phase-Aware Tracking
- Content Formatting
- PlantUML Server Configuration
Features
- Generated Reports
- Search Syntax
- Component Diagrams
- PlantUML Browser Rendering
- Inline SVG Rendering
- Internal Flow Tracking
- Tags and Attributes
- Excluding Requests
- Excluded Headers
- Multi-Host Test Architectures
- Event-Driven Architecture Testing
- Service Bus Tracking Patterns
- Background Thread Correlation
- Parallel-Safe Background Correlation
- Event & Message Tracking
- Assertion Tracking
- Step Tracking
- Tabular Attributes
- Large Response and Diagram Handling
- Diagnostics and Debugging
- CI Summary Integration
- CI Artifact Upload
- Merging Parallel Reports
Reference