Skip to content

test(emulator): expand RTU transport test coverage #249

Description

@groupsky

Description

Expand test coverage for RTU transport to include handler execution, error paths, and edge cases.

Current Coverage

Unit tests (15 tests):

  • ✓ Lifecycle (create, start, stop, double-start)
  • ✓ Configuration (all serial port options)
  • ✓ Basic request handler registration

Integration tests (14 tests):

  • ✓ Emulator initialization with RTU
  • ✓ Device management
  • ✓ Configuration options

Coverage: 40.8% (below 95% threshold)

Missing Test Coverage

1. Handler Execution Tests

No tests verify actual request/response flow through handler methods.

2. Error Path Tests

  • Invalid response format
  • Handler rejection/error throwing
  • Malformed responses

3. ServiceVector Integration

  • Verify all 8 callbacks are registered
  • Test callback invocation

4. Edge Cases

  • Empty register reads
  • Maximum register count
  • Concurrent operations

Acceptance Criteria

  • Add handler execution tests (8+ tests)
  • Add error path tests (6+ tests)
  • Add ServiceVector integration tests (4+ tests)
  • Add edge case tests (4+ tests)
  • Achieve >80% code coverage for rtu.ts
  • All tests pass
  • Document testing approach

Priority

Medium - Improves confidence and regression prevention

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions