Skip to main content

Notification Event Testing

Summary

Event coverage is one PowerShell smoke script with two modes, supported by two test endpoints and a forced-failure header. No automated test project exercises the consumer, the resolver or the envelope.

Audience

Engineers, QA, DevOps engineers, architects and support.

Event testing

Two modes

Direct mode, the default, posts to the dispatch hook. The dispatcher runs synchronously in the request and returns the created message identifiers directly. This covers idempotency, staleness, template resolution, rendering, delivery, retry and audit — without a broker.

Broker mode posts to the publish hook, which places the event on the exchange so the consumer round-trips it. This is the only automated coverage of the consumer, the queue bindings and the envelope parsing.

Because publishing is asynchronous, broker mode cannot receive message identifiers from the response. The script compensates by polling for the processed-event row and then reading the audit trail to recover the identifiers — a verified difference in test shape between the two modes.

Forced failure

Both hooks accept a forced-failure flag. Direct mode carries it on the envelope; broker mode adds it as a message header that the consumer parses back onto the envelope. Every channel sender honours it, so the delivery-failure and retry paths are exercised deterministically without depending on a provider outage.

What broker mode verifies

By round-tripping, broker mode implicitly confirms that the exchange and queue are declared, that the binding for the tested event type exists, that the publisher's headers and properties are written, and that the consumer's parser reconstructs the envelope well enough to dispatch — including the forced-failure header.

Not covered

  • No assertion on the duplicate path via broker redelivery — duplicate suppression is exercised through the direct hook only.
  • No assertion on the negative-acknowledgement and requeue path; no test forces an infrastructure failure.
  • No assertion on the unbounded-requeue behavior described in retry and redelivery.
  • No test of the missing-event-identifier fallback, where a generated identifier defeats idempotency.
  • No test asserting that all 42 bindings exist — only the event types the script drives are exercised.
  • No test of the channel-override configuration map.
  • No test of correlation propagation, the effective-correlation gap, or trace-identifier capture.
  • No ordering or concurrency test.
  • No contract test pinning any of the 14 payload shapes, which is where the 32 locally duplicated records would most benefit.

Verified absence of automation

No test project in the repository references the consumer, the resolver, the envelope or the event bus. The smoke script is the only automated artifact, and it requires a running service, a database and — in broker mode — a running broker.

Recorded as recommendations only, none exist today.

  • Contract tests pinning the four service-local payload records against their publishers' emitted shapes, which would convert silent runtime drift into a build failure.
  • A binding-completeness test asserting one binding per supported event type.
  • Consumer tests for negative acknowledgement, requeue and the poison-message loop.
  • Envelope parsing tests covering every fallback branch, especially the generated-identifier path.
  • An idempotency test driven through the broker rather than the direct hook.

Classification

Foundation — smoke coverage in two modes is Implemented; automated event testing is Not implemented.

Requires confirmation

Whether the smoke script runs in continuous integration, and whether broker mode runs there, require confirmation.

See Also

Keywords

  • Notification database
  • Event Testing
  • Draft database documentation

Source References

  • microservices/scripts/smoke-notification.ps1
  • microservices/src/notification-service/Api/NotificationEndpoints.cs
  • microservices/src/notification-service/Messaging/NotificationEventConsumer.cs
  • microservices/src/notification-service/Messaging/NotificationEventEnvelope.cs
  • microservices/src/notification-service/Application/NotificationDispatcher.cs

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-21
  • Review cycle: Quarterly