Task-Tracker-Systems / Task-Tracker-Device

Sources for a task time recording device.
https://task-tracker-systems.github.io/Task-Tracker-Device/
MIT License
2 stars 0 forks source link

restructure test environments? #83

Closed dhebbeker closed 4 weeks ago

dhebbeker commented 11 months ago

Can the test environments defined in platformio.ini be defined per package instead of per component?

dhebbeker commented 10 months ago

When compiling parts of the software which are in the lib_dir directory, the whole component/library which contains that part will be compiled (see also question in PlatformIO community). Thus it does not make sense to have separate environments for software parts which are in the same library.

Also one test environment can use multiple test applications (see manual).

This means, we can at least reduce the number of test environments to the number of different libraries (which are our "packages"). The only difference of these test environments should be the additional include paths as per Dependency Rule. One could further argue, that those differences are not worth maintaining different environments and merging those together.

Tests for units from the package "3rd party library adapters" may require additional dependencies (like ArduinoFake). A separate environment for that package may be advisable.

dhebbeker commented 10 months ago

Testing package "3rd party library adapters"

Mocking 3rd party software can be challenging. This is why the dependency to that software is reduced to that particular package.

Still some libraries can be mocked. For example the Arduino Framework using ArduinoFake.

As this package will contain a mix of mockable / testable units and some which can not successfully compile. One may modify the adapter source code which can not compile in the test environment using #ifndef PIO_UNIT_TESTING. This way even this package can be compiled for tests, although only those units who's dependencies are mockable can be actually tested.