Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor CppUTest tests to gtest #96

Closed
rlenferink opened this issue Sep 28, 2019 · 3 comments
Closed

Refactor CppUTest tests to gtest #96

rlenferink opened this issue Sep 28, 2019 · 3 comments
Labels
component/testing Categorizes an issue or PR relevant to testing. kind/improvement Categorizes issue or PR as related to improvements.
Milestone

Comments

@rlenferink
Copy link
Member

Currently CppUTest is used for testing and mocking and although this framework works fine, I would be handier to move to gtest( google test) for a few reasons:

  1. more easier to integrate as a external project
  2. much more heavily used than CppUTest
  3. integrated support in the CLion IDE. This means that the IDE supports directly running/debugging individually testcases/testsuites.

This would also mean that the cpputest mocks should be removed. This can be done as long as we keep the code coverage as good as intact.


Original creation date: 06/May/2018
Reporter: @pnoltes

@rlenferink rlenferink added kind/improvement Categorizes issue or PR as related to improvements. component/testing Categorizes an issue or PR relevant to testing. labels Sep 28, 2019
@rlenferink rlenferink added this to the 3.0.0 milestone Sep 28, 2019
@rlenferink
Copy link
Member Author

Comment by Johan:

Potential issues would be:

  • CppUTest is easy to build for an end-user and is typically distributed with the package manager. For gtest+gmock this is not the case and the end-user needs to build and install from source by themselves. Alternatively Celix could bundle the binaries and headers, which would add work on the project side instead of the user side.
  • gmock does not support mocking C functions exactly, there are ways of working around this[0][1] which either introduces extra boilerplate or an extra dependency.

[0] https://github.com/hjagodzinski/C-Mock
[1] https://stackoverflow.com/questions/31989040/can-gmock-be-used-for-stubbing-c-functions

@PengZheng
Copy link
Contributor

CppUTest is easy to build for an end-user and is typically distributed with the package manager. For gtest+gmock this is not the case and the end-user needs to build and install from source by themselves. Alternatively Celix could bundle the binaries and headers, which would add work on the project side instead of the user side.

With Conan package manager, one extra line like self.test_requires("gtest/1.10.0") will make gtest ready to use.

Mocking C functions is indeed an issue.

@PengZheng
Copy link
Contributor

This has been addressed by #711.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/testing Categorizes an issue or PR relevant to testing. kind/improvement Categorizes issue or PR as related to improvements.
Projects
None yet
Development

No branches or pull requests

2 participants