Azure Notification Hub Integration Testing Strategy

Updated: 2026-07-07 15:49 ET · Audited: 2026-06-26 · Version: 1.0 · Draft date: 2026-02-20 · Status: AB#1892 — Backlog

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

1. Testing Strategy

1.1 Device Registration Testing

iOS (APNS) Registration Test Cases

Android (FCM) Registration Test Cases

Cross-Platform Registration

1.2 Tag-Based Targeting

User Segmentation Tags

Tag Expressions

1.3 Template Notifications

1.4 Scheduled and Delayed Notifications

1.5 Multi-Platform Delivery Verification

1.6 Error Handling

1.7 Performance and Scale Testing

TestTarget
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 limit5,000 req/min — exponential backoff verified

1.8 Azure NH SDK Integration Tests

1.9 Monitoring and Diagnostics

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.

2. Implementation Roadmap

PhaseTimelineObjectiveEffort
Phase 1: FoundationWeeks 1–2Test infrastructure, unit tests, mock Azure NH client, CI pipeline5–7 days
Phase 2: Core IntegrationWeeks 3–4Real Azure NH (staging), physical device pool, tag targeting, templates8–10 days
Phase 3: Advanced & E2EWeeks 5–6Scheduled notifications, bulk send, offline/online, performance benchmarks10–12 days
Phase 4: Production ReadinessWeek 7Monitoring dashboard, alert playbook, production smoke tests5–7 days

CI/CD Integration

# 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

3. Tools and Setup

3.1 Azure NH REST API

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}).

3.2 Test Harness Requirements

3.3 Mock Setup (Unit Tests)

public 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);
}

3.4 Daily Smoke Test Script

Automated script runs daily at 6 AM UTC: registers test device → sends test notification → verifies outcome → cleans up registration. Runtime ~5 minutes.

4. Test Data Management

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.

5. Success Criteria

CategoryTarget
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
Uptime99.9% (excluding scheduled maintenance)

6. Risk Assessment

RiskProbabilityImpactMitigation
Azure NH service outageLowHighRetry logic with exponential backoff; monitor Azure status
Expired device tokens accumulateMediumMediumAutomated cleanup job; feedback loop from APNS/FCM
Tag limit exceeded (20 tags/device)MediumMediumTag pruning strategy; validation before registration
iOS APNS certificate expirationLowHighAutomated certificate expiry monitoring; 30-day advance alerts
Android FCM legacy → v1 API migrationMediumMediumPlan FCM v1 API migration; test dual support
Production data leaked to stagingLowHighStrict environment separation; separate Azure NH namespaces

7. Appendix: Azure NH Configuration Checklist

Useful Azure NH CLI Commands

# 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

Glossary