Name Date Size #Lines LOC

..--

Readme.mdH A D01-Oct-20251.1 KiB2418

meson.buildH A D09-Dec-20253.5 KiB128118

modbus_server_tester.cppH A D08-Dec-20255.2 KiB187145

modbus_server_tester.hppH A D09-Dec-20253.8 KiB9875

test_base.cppH A D08-Dec-20251.8 KiB6854

test_base.hppH A D08-Dec-2025805 3525

test_device_events.cppH A D09-Dec-202510.5 KiB290248

test_events.cppH A D09-Dec-202510.8 KiB300262

test_firmware.cppH A D08-Dec-20254.5 KiB136112

test_inventory.cppH A D08-Dec-20253.9 KiB10989

test_modbus.cppH A D08-Dec-20252.3 KiB8563

test_modbus_commands.cppH A D01-Oct-20255.7 KiB178150

test_port.cppH A D08-Dec-20256.6 KiB219170

test_sensors.cppH A D08-Dec-20258.1 KiB223187

Readme.md

1# Testing
2
3## Mocked Modbus Testing
4
5The `socat` command is utilized to create pseudo-terminals (PTYs), enabling the
6setup of virtual serial ports for communication between a Modbus client and
7server. In this testing framework, the Modbus client (implemented as a test
8client using gtest) sends Modbus commands to a test server, which processes
9these requests and returns responses. The test environment setup is responsible
10for configuring the pseudo-terminals and launching the test server instance. The
11server logic resides in `modbus_server_tester.cpp::ServerTester`, with further
12details provided in the following sections.
13
14### ServerTester
15
16`ServerTester` acts as a mock Modbus server, intercepting Modbus messages and
17generating appropriate responses. The replies are determined by the mocked
18Modbus addresses, allowing targeted code paths to be exercised on the client
19side. `ServerTester` is capable of handling both single and segmented response
20scenarios, and also provides error responses to facilitate negative testing. The
21test server currently handles the following Modbus command:
22
23- ReadHoldingRegisters
24