In order to run automated tests without requiring physical PoKeys devices, all interactions with pokeyslib should be mocked. A separate version of pokeyslib will be created specifically for testing purposes. This mock library will simulate the behavior of the PoKeys devices to ensure that the components can be tested in isolation and in conjunction with LinuxCNC without the need for hardware.
Tasks:
Set Up Continuous Integration (CI) Pipeline:
Configure GitHub Actions for CI to automatically run tests on each push or pull request.
Ensure the CI pipeline runs on debian-latest (or another suitable environment) with LinuxCNC.
The CI pipeline should be configured for both user-space and real-time components (pokeys_py, pokeys_rt, pokeys.comp).
Create a Mock Version of pokeyslib:
Develop a mock version of pokeyslib that simulates PoKeys device behavior.
The mock version should replicate the API of the real pokeyslib but provide controlled, predictable outputs.
Ensure that the mock library includes simulations for all major components: Digital IO, Analog IO, Counters, PWM, and PEv2.
Include mock responses for device setup, configuration, and data retrieval.
Create Unit Tests Using the Mocked pokeyslib:
Implement unit tests for each major component (Digital IO, Analog IO, PWM, PEv2, PoExtBus, etc.).
Use the mock version of pokeyslib to simulate hardware responses during tests.
Ensure tests validate both correct inputs and error conditions.
Create Integration Tests:
Set up integration tests to validate interaction between pokeys_py, pokeys_rt, pokeys.comp, and LinuxCNC.
Test custom homing procedures, digital/analog IO, counters, and PWM with the mocked pokeyslib.
Use LinuxCNC’s simulation mode to run the tests without requiring real-time hardware.
Implement Mock-Specific CI Pipeline:
Add a CI pipeline that uses the mocked version of pokeyslib.
Ensure the pipeline runs both unit and integration tests with the mock library.
Ensure that the pipeline works with LinuxCNC in simulation mode.
Test LinuxCNC Integration:
Validate that components interact correctly with LinuxCNC using the mock library and simulation mode.
Test the custom homing process and ensure pokeys_homecomp.comp works as expected with LinuxCNC.
Add Coverage Reports:
Use coverage.py to generate code coverage reports.
Ensure coverage reports are uploaded to GitHub or a third-party service (e.g., Codecov).
Include both unit and integration test coverage.
Document the Testing Process:
Create a TESTING.md file with instructions for setting up and running tests locally and in CI.
Include detailed information on using the mock pokeyslib, LinuxCNC simulation mode, and how to troubleshoot issues.
Acceptance Criteria:
[ ] A mock version of pokeyslib is created and fully replicates device behavior.
[ ] GitHub Actions pipeline is configured and runs on each push/pull request.
[ ] Unit tests cover all major components with the mock pokeyslib.
[ ] Integration tests validate interaction between components and LinuxCNC simulation.
[ ] The CI pipeline runs successfully with the mock library and simulation mode.
[ ] Code coverage reports are generated and uploaded.
[ ] TESTING.md provides clear instructions for running tests locally and in CI.
Automated Testing Setup with Mocked
pokeyslib
Description:
In order to run automated tests without requiring physical PoKeys devices, all interactions with
pokeyslib
should be mocked. A separate version ofpokeyslib
will be created specifically for testing purposes. This mock library will simulate the behavior of the PoKeys devices to ensure that the components can be tested in isolation and in conjunction with LinuxCNC without the need for hardware.Tasks:
Set Up Continuous Integration (CI) Pipeline:
debian-latest
(or another suitable environment) with LinuxCNC.pokeys_py
,pokeys_rt
,pokeys.comp
).Create a Mock Version of
pokeyslib
:pokeyslib
that simulates PoKeys device behavior.pokeyslib
but provide controlled, predictable outputs.Create Unit Tests Using the Mocked
pokeyslib
:pokeyslib
to simulate hardware responses during tests.Create Integration Tests:
pokeys_py
,pokeys_rt
,pokeys.comp
, and LinuxCNC.pokeyslib
.Implement Mock-Specific CI Pipeline:
pokeyslib
.Test LinuxCNC Integration:
pokeys_homecomp.comp
works as expected with LinuxCNC.Add Coverage Reports:
coverage.py
to generate code coverage reports.Document the Testing Process:
TESTING.md
file with instructions for setting up and running tests locally and in CI.pokeyslib
, LinuxCNC simulation mode, and how to troubleshoot issues.Acceptance Criteria:
pokeyslib
is created and fully replicates device behavior.pokeyslib
.TESTING.md
provides clear instructions for running tests locally and in CI.References: