Skip to content

Protocol conformance test suite #620

@gijzelaerr

Description

@gijzelaerr

Summary

Create a dedicated test suite that validates the library's protocol implementation against the S7 protocol specification, covering packet structure, error codes, and edge cases.

Background

The current tests validate functionality (read/write works, server responds correctly) but don't systematically verify protocol-level correctness. A conformance suite would test that every PDU is correctly formed according to the protocol specification.

What needs to be done

  • Collect reference packet captures from known-good implementations (Wireshark captures from real PLCs)
  • Create test cases that verify PDU encoding matches expected byte sequences
  • Create test cases that verify PDU decoding handles all valid packet variations
  • Test all S7 error codes are correctly parsed and mapped
  • Test TPKT framing edge cases (fragmentation, maximum sizes)
  • Test COTP connection establishment variations
  • Test PDU size negotiation boundary conditions
  • Test malformed packet handling (fuzzing-style tests for robustness)
  • Verify multi-packet (fragmented) transfer assembly
  • Add as a separate pytest marker (e.g., pytest -m conformance)

Notes

  • Wireshark's S7 dissector is a good reference for expected packet formats
  • Could use captured pcap files as test fixtures
  • This would also help validate S7CommPlus protocol implementation as it develops

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions