Skip to content

Add parameter validation E2E tests for device-profiler #369

@groupsky

Description

@groupsky

Description

Add E2E test coverage for device-profiler parameter boundary conditions and validation.

Context

PR #366 adds device-profiler E2E tests covering happy paths and basic error cases. However, parameter validation at boundaries is not comprehensively tested in E2E (though unit tests provide coverage).

Test Scenarios

Address Range Validation

  • Test --start > --end (invalid range)
ya-modbus-profile --port /tmp/ttyV1 --slave-id 1 --start 100 --end 50
  • Expected: Command-line error or validation error

Batch Size Validation

  • Test --batch 0 (invalid)
  • Test --batch -1 (negative)
  • Test very large batch size (e.g., 200)

Slave ID Validation

  • Test --slave-id 0 (below minimum of 1)
  • Test --slave-id 248 (above maximum of 247)
  • Already tested: slave ID 999 (out of range)

Large Address Ranges

  • Test scanning large range (e.g., 0-1000)
  • Verify performance and memory usage are reasonable
  • Ensure scan completes without hanging

Maximum Register Address

  • Test scanning at maximum Modbus address (65535)
  • Verify address boundary handling

Implementation

Add tests to tests/e2e/tests/05-device-profiler.bats:

  • Group under "Parameter Validation Tests" section
  • Use assert_failure for invalid parameters
  • Use assert_output_contains to verify error messages

Acceptance Criteria

  • Invalid address range test passes
  • Batch size validation tests pass
  • Slave ID boundary tests pass
  • Large range scan test passes
  • Error messages are clear and helpful

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:lowLow priority taskscope:device-profilerIssues related to the device-profiler packagescope:testingIssues related to testing infrastructuretestingTesting improvements and additionstype:testingTesting improvements or additionsvalidationInput validation and configuration checks

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions