Adding support of googletest / googlemock #83689
Labels
area: Test Framework
Issues related not to a particular test, but to the framework instead
RFC
Request For Comments: want input from the community
Introduction
Zephyr already provide an awesome test suite that work very well with C but seems more limited with C++.
It would be great having googletest and googlemock available in Zephyr for testing complex C++ libraries or applications.
Problem description
I guess the major issue is mocking a C++ class is not easily doable and is quite limited with the current test suite.
In addition, gmock and gtest are widely used, supporting it in zephyr would simplify writing C++ tests.
Proposed change
Create a googletest external module that could be used to write tests using gmock and gtest.
Proposed change (Detailed)
I would to update googletest to support Zephyr, update it to make it an external module.
I guess that Zephyr OS support itself should accepted upstream, not sure about the external module changes so we may have to fork googletest.
I would also adds some unit tests example written with gtest to demonstrate how using it with twister, and also, to make sure the test suite is working correctly.
There is also some changes to do in gtest harness (I need to check if this still the case on master) . I am not sure why, it was not able to parse the tests output.
Dependencies
This would add a new component, googletest to zephyr. I think we could make it optional since I think it should only downloaded if this is actually used by a project. Ideally, all the required changes in googletest would be upstream. If this is not the case, we may to fork it.
Alternatives
I have looked for some alternatives for testing / mocking C++ code but I have not found anything already supported by Zephyr.
In addition, I am working on projects already using it.
The text was updated successfully, but these errors were encountered: