Issue: Implement Mocking and Unit Tests for PoKeysLib Integration Without Hardware
Description
To ensure continuous integration and testing of the PoKeysLib integration in the LinuxCNC system without requiring physical PoKeys hardware, we need to implement mocking and simulation strategies for hardware components. This will allow us to run tests on CI platforms such as GitHub Actions, ensuring that critical parts of the system can be validated without direct access to the hardware.
Tasks
Mock Hardware Interfaces:
Implement mock objects for the PoKeysLib device interactions such as digital I/O, analog I/O, counters, and PWM.
Ensure that mock objects replicate the behavior of actual PoKeys devices and provide expected values or simulate edge cases (e.g., hardware failure, timeouts).
Dependency Injection for Device Interface:
Refactor code to allow dependency injection for the hardware interface.
Enable the swapping of real PoKeys hardware with mocks or simulators for testing purposes.
Simulator for Complex Device Behaviors:
Create a simulator class that mimics more complex PoKeys device interactions.
This should simulate real-time updates, axis movements, homing sequences, etc., allowing more detailed testing of motion control.
CI Testing Configuration:
Configure GitHub Actions to run the test suite with mocks and simulators in place of real hardware.
Implement environment checks to switch between real hardware (for local testing) and mock objects (for CI testing).
Add Unit Tests for PoKeys Integration:
Add unit tests that verify the interaction between the application logic and the mocked PoKeys device.
Ensure coverage for key features like digital I/O state changes, axis position feedback, homing, and error conditions.
Update Documentation:
Provide documentation on how to run tests locally with real hardware versus how to run tests in the CI environment using mocks/simulators.
Include instructions for setting environment variables to toggle between real and mock devices.
Benefits
Increased Test Coverage: Enable automated testing on GitHub without requiring physical hardware, ensuring more consistent and frequent test runs.
Faster Development Cycles: By implementing mocks and simulators, developers can work on the logic without waiting for hardware access.
Improved Code Quality: Continuous integration with unit tests will help catch issues early in the development cycle.
Issue: Implement Mocking and Unit Tests for PoKeysLib Integration Without Hardware
Description
To ensure continuous integration and testing of the
PoKeysLib
integration in the LinuxCNC system without requiring physical PoKeys hardware, we need to implement mocking and simulation strategies for hardware components. This will allow us to run tests on CI platforms such as GitHub Actions, ensuring that critical parts of the system can be validated without direct access to the hardware.Tasks
Mock Hardware Interfaces:
Dependency Injection for Device Interface:
Simulator for Complex Device Behaviors:
CI Testing Configuration:
Add Unit Tests for PoKeys Integration:
Update Documentation:
Benefits
Resources
Acceptance Criteria