Skip to main content

Attendance Event Integration Testing Guide

Summary

Test events with synthetic identities in isolated databases and broker infrastructure. No Attendance-specific formal .NET test project exists in current backend source.

Audience

  • Backend developers, QA engineers, integration owners, DevOps engineers, and release reviewers

Prerequisites

  • Disposable PostgreSQL and broker infrastructure
  • Current migrations and shared contracts
  • Synthetic tenant, employee, and Attendance data
  • Ability to inspect outbox, consumer projections, ledgers, and audit evidence

Procedure

Unit tests

Assert each aggregate action raises its exact domain event, no unsupported action raises one, and domain-to-integration mapping selects the correct version-1 contract and context.

Persistence integration tests

Verify business/outbox atomicity, serialization, unique event identity, correlation, schema version, rollback, and failed-publication eligibility.

Contract tests

Freeze representative public-safe serialization fixtures. Test additive-field tolerance, numeric Attendance context, empty optional envelope context, and the generated-identifier edge case.

Broker integration tests

Verify publish routing by event type, redelivery, duplicate delivery, acknowledgement, publish retry, and absence of global-order assumptions without exposing topology names.

Consumer tests

For Payroll, verify Submitted/Approved projection behavior, duplicate suppression, stale-event rejection, and audit. For Integration Service, verify Submitted/Approved/Rejected routing, idempotency, downstream failure, and durable failure handling. Notification intent resolution for Attendance should currently yield no direct subscription and must not be assumed.

End-to-end and smoke tests

Run isolated Attendance and integration smoke coverage, then trace event identity from command through outbox, broker, consumer ledger, and projection/audit.

Parity and cutover tests

Use the existing parity and go/no-go helpers for their supported Attendance/Time Office scope. Confirm compatibility and direct routes produce equivalent lifecycle events where they converge on the same application command.

Validation or Expected Result

Evidence must show all five domain events, five mappings, version 1, atomic outbox behavior, duplicate-safe consumers, correct stale-event handling, and no unsupported consumer claims. Failures must be diagnosable without real employee or customer data.

Troubleshooting

If an outbox row exists but no consumer state changes, distinguish pending/failed publication, broker delivery, subscription, consumer rejection, deduplication, and staleness. Do not modify production messages or databases directly.

Source References

  • microservices/src/attendance-service/Domain/Attendance/AttendanceDomainEvents.cs
  • microservices/src/attendance-service/Infrastructure/AttendanceDbContext.cs
  • microservices/src/payroll-service/Messaging/PayrollReadModelConsumer.cs
  • microservices/src/integration-service/Orchestration/EventDispatcher.cs
  • microservices/scripts/smoke-attendance.ps1
  • microservices/scripts/smoke-integration.ps1
  • microservices/scripts/compare-attendance-shift-parity.ps1
  • microservices/scripts/attendance-shift-cutover-go-no-go.ps1

See Also

Keywords

  • Attendance events
  • Integration contracts
  • Eventual consistency

Revision Information

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