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

Use mocks for testing. #27

Closed
sleepdefic1t opened this issue Dec 3, 2018 · 8 comments · Fixed by #66
Closed

Use mocks for testing. #27

sleepdefic1t opened this issue Dec 3, 2018 · 8 comments · Fixed by #66
Assignees
Labels
Test: General The issue or pull request is related to the test config, platform or setup. Type: Refactor The pull request improves or enhances an existing implementation.

Comments

@sleepdefic1t
Copy link
Contributor

sleepdefic1t commented Dec 3, 2018

Is your feature request related to a problem? Please describe.

The current Cpp-Client tests use calls to actual nodes.
This ties the success of tests to the connected nodes state;
the aim should be to test the Cpp-Client's code independently.

Describe the solution you'd like

Use mock tests instead of sending requests to external nodes.

@ciband
Copy link
Contributor

ciband commented Dec 3, 2018

For the desktop OS's, GMock is already available and should probably be used.

For IoT/PlatformIO, The AUnit library supports mocks but (ideally) a GMock adapter would need to be written to support a single unit test code base between desktop and IoT, just like we do for GTest.

This GMock adapter (if successful) should be contributed back to AUnit just like the GTest adapter has.

@ciband
Copy link
Contributor

ciband commented Dec 14, 2018

Another approach to this would be to use GTest/GMock on IoT and drop usage of AUnit.

googletest has just merged my PR to add PIO support.

google/googletest#2000

The next step is to add the library into the PIO library manager. I have plans to get this going. Once done we should be able to use GTest/GMock for IoT.

@ciband ciband self-assigned this Dec 15, 2018
@ciband
Copy link
Contributor

ciband commented Dec 15, 2018

This is being held up by this:
google/googletest#2013

@ciband ciband mentioned this issue Dec 27, 2018
6 tasks
@sleepdefic1t
Copy link
Contributor Author

#44 by @ciband adds Mocks and resolves this issue/feature request.

@ciband
Copy link
Contributor

ciband commented Dec 30, 2018

There is not PIO support for the mocks yet. That is in work. Initial support has been added to google test and I am now working through library manager issues.

I would like to leave this open for tracking until that support is in place.

@ciband ciband reopened this Dec 30, 2018
@faustbrian faustbrian added Type: Refactor The pull request improves or enhances an existing implementation. Test: General The issue or pull request is related to the test config, platform or setup. labels Jan 4, 2019
@sleepdefic1t
Copy link
Contributor Author

@ciband Any progress on this?

@ciband
Copy link
Contributor

ciband commented Jan 28, 2019

Change was finally approved and merged into GTest late last week.

Next task is for me to check to see if updated have been published to PIO and then retest and iterate.

@ciband
Copy link
Contributor

ciband commented Feb 13, 2019

Once #66 is merged, the next step is to add support for ESP8266.

Once ESP8266 is supported, this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Test: General The issue or pull request is related to the test config, platform or setup. Type: Refactor The pull request improves or enhances an existing implementation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants