TL;DR: Proposed testing strategy for the Azure Notification Hub push integration (AB#1892 — Backlog, not yet implemented). Basic push already works via Azure NH; the gap is that no comprehensive integration-testing or validation framework exists. The plan covers device registration (APNS/FCM), tag-based targeting, templates, error handling, performance/scale targets, and monitoring, phased over a 7-week roadmap. The payload contract itself lives in the push notification payload reference.
Comprehensive testing strategy for Azure Notification Hub (ANH) integration in ALPA Mobile (.NET MAUI 10). Covers device registration, tag-based targeting, template notifications, error handling, performance testing, and monitoring across iOS (APNS) and Android (FCM) platforms.
Current State: Basic push notifications functional via Azure NH
Gap: No comprehensive integration testing or validation framework
Goal: Establish robust testing coverage to ensure reliable push notification delivery
member:active, member:inactive, member:retiredbase:ORD, base:ATL — multi-base OR logic, base change updates tagsrole:captain, role:fo, role:committeebase:ORD || base:DEN), AND (member:active && role:captain){{firstName}}, {{baseCode}}), multi-language templates| Test | Target |
|---|---|
| 1,000 device broadcast | <5s for send request, 95% delivery within 30s |
| Concurrent registrations (100 simultaneous) | <2s per registration |
| Tag update for 1,000 devices | <30s for batch completion |
| Azure NH rate limit | 5,000 req/min — exponential backoff verified |
Azure Portal alerts configured for: failed notifications >5%, registration errors >10/hour, service unavailability, quota usage >80%.
Custom Sentry breadcrumbs trace the full push flow: registration → token → Azure NH → delivery.
| Phase | Timeline | Objective | Effort |
|---|---|---|---|
| Phase 1: Foundation | Weeks 1–2 | Test infrastructure, unit tests, mock Azure NH client, CI pipeline | 5–7 days |
| Phase 2: Core Integration | Weeks 3–4 | Real Azure NH (staging), physical device pool, tag targeting, templates | 8–10 days |
| Phase 3: Advanced & E2E | Weeks 5–6 | Scheduled notifications, bulk send, offline/online, performance benchmarks | 10–12 days |
| Phase 4: Production Readiness | Week 7 | Monitoring dashboard, alert playbook, production smoke tests | 5–7 days |
# Pseudo-pipeline config
stages:
- stage: UnitTest
# Run on every PR
- dotnet test **/ALPA.Mobile.Tests.Unit.csproj --filter Category=Push
- stage: IntegrationTest
condition: develop branch merges
- dotnet test **/ALPA.Mobile.Tests.Integration.csproj --filter Category=AzureNH
- stage: E2ETest
condition: main branch
pool: macOS-latest (for iOS)
- npm run test:e2e:push
Base URL: https://<namespace>.servicebus.windows.net/<notificationHub>
Key endpoints: Create/Update Registration (PUT /registrations/{id}), Query Registrations (GET /registrations), Send Notification (POST /messages), Get Outcome (GET /messages/{id}).
alpa-mobile-nh-staging — isolated from productionhttps://staging-api.alpa.org with test databasepublic interface IAzureNotificationHubClient
{
Task<RegistrationDescription> CreateOrUpdateRegistrationAsync(
string deviceToken, IEnumerable<string> tags, CancellationToken ct = default);
Task DeleteRegistrationAsync(string registrationId, CancellationToken ct = default);
Task<NotificationOutcome> SendNotificationAsync(
Notification notification, string tagExpression, CancellationToken ct = default);
}
Automated script runs daily at 6 AM UTC: registers test device → sends test notification → verifies outcome → cleans up registration. Runtime ~5 minutes.
Test user accounts for staging environment (captain at ORD, FO at DEN, retired at ATL). Test device inventory tracked in spreadsheet (device ID, platform, OS version, registration ID, tags, last tested). Pre-defined notification templates: basic-alert, personalized-alert (with {{firstName}}, {{baseCode}}), deep-link.
| Category | Target |
|---|---|
| Unit Test Coverage | ≥80% for push notification code |
| E2E Test Coverage | ≥10 real-device scenarios (iOS + Android) |
| Registration Latency | <2s (p95) |
| Notification Send Latency | <200ms to Azure NH API (p95) |
| Delivery Latency | <30s from send to device (p95) |
| Bulk Send Throughput | ≥1,000 notifications/minute |
| Error Rate | <1% under normal conditions |
| Uptime | 99.9% (excluding scheduled maintenance) |
| Risk | Probability | Impact | Mitigation |
|---|---|---|---|
| Azure NH service outage | Low | High | Retry logic with exponential backoff; monitor Azure status |
| Expired device tokens accumulate | Medium | Medium | Automated cleanup job; feedback loop from APNS/FCM |
| Tag limit exceeded (20 tags/device) | Medium | Medium | Tag pruning strategy; validation before registration |
| iOS APNS certificate expiration | Low | High | Automated certificate expiry monitoring; 30-day advance alerts |
| Android FCM legacy → v1 API migration | Medium | Medium | Plan FCM v1 API migration; test dual support |
| Production data leaked to staging | Low | High | Strict environment separation; separate Azure NH namespaces |
# List registrations for a specific tag
az notification-hub notification list \
--resource-group alpa-mobile-rg \
--namespace-name alpa-mobile-nh-staging \
--notification-hub-name alpa-mobile-hub-staging \
--filter "tags contains 'base:ORD'"
# Send test notification via CLI
az notification-hub notification send \
--resource-group alpa-mobile-rg \
--namespace-name alpa-mobile-nh-staging \
--notification-hub-name alpa-mobile-hub-staging \
--payload '{"aps":{"alert":"CLI test"}}' \
--apple
base:ORD)