Name Date Size #Lines LOC

..--

Readme.mdH A D01-Oct-20251.1 KiB2418

meson.buildH A D02-Sep-20252.7 KiB10395

modbus_server_tester.cppH A D16-Oct-20254.7 KiB161124

modbus_server_tester.hppH A D02-Sep-20253.4 KiB8969

test_events.cppH A D16-Oct-202510.8 KiB300262

test_firmware.cppH A D02-Sep-20256.3 KiB193156

test_inventory.cppH A D22-Oct-20255.9 KiB172137

test_modbus.cppH A D01-Oct-20254 KiB139106

test_modbus_commands.cppH A D01-Oct-20255.7 KiB178150

test_port.cppH A D22-Oct-20258.2 KiB271211

test_sensors.cppH A D16-Oct-20258.3 KiB245197

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