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

Mock tests setup #250

Open
wants to merge 3 commits into
base: next-bidirectional
Choose a base branch
from
Open

Mock tests setup #250

wants to merge 3 commits into from

Conversation

AdityaKasar
Copy link
Contributor

No description provided.

@CLAassistant
Copy link

CLAassistant commented Mar 14, 2025

CLA assistant check
All committers have signed the CLA.

@@ -28,6 +28,7 @@ list(APPEND SOURCES
Transport/Transport.cpp
Accessor/Accessor.cpp
Async/Async.cpp
Properties/Properties.cpp
Copy link
Contributor

@tomasz-blasz tomasz-blasz Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed, all methods in Propierties class are static and should remain static. Tests should verify code as it is

@@ -57,6 +57,11 @@ namespace FireboltSDK

void TransportUpdated(Transport<WPEFramework::Core::JSON::IElement>* transport);

void UpdateGateway(std::unique_ptr<GatewayImpl> mockGateway)
Copy link
Contributor

@tomasz-blasz tomasz-blasz Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as it is only for tests, should be at least under #ifdef ... #endif block, not exposed for any other application using the API.

Copy link
Contributor

@tomasz-blasz tomasz-blasz Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several things:

  • Application class MUST NOT inherit from a class created for testing purposes. You should make tests for sources as they are without adopting them to your needs
  • Keep existing formatting as it is, it makes comparison easier, I am referring to
    • Moving brackets to new lines
    • Changing argument convention from type& arg to type &arg, I am not arguing here which convention is better, just it is out of the scope of this task

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree for the formatting changes, I think my editors autoformator might have made that. I will try to revert it

Copy link
Contributor

@tomasz-blasz tomasz-blasz Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That class cannot be a part of the application, it has been create for fulfill test scenarios, so its place is in test/ in SDK.

Copy link
Contributor

@tomasz-blasz tomasz-blasz Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That class cannot be a part of the application, it has been create for fulfill test scenarios, so its place is in test/ in SDK.

Copy link
Contributor

@tomasz-blasz tomasz-blasz Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That class cannot be a part of the application, it has been create for fulfill test scenarios, so its place is in test/ in SDK.

Copy link
Contributor

@tomasz-blasz tomasz-blasz Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That class cannot be a part of the application, it has been create for fulfill test scenarios, so its place is in test/ in SDK.

Copy link
Contributor

@tomasz-blasz tomasz-blasz Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, do not modify existing sources to fulfil test requirements.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, do not modify existing sources to make tests working.
Also, the same as for Gateway, application class MUST NOT inherit from mock classes created just for testing purposes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Properties class won't be changes to make tests, that change would be not needed.

Copy link
Contributor

@tomasz-blasz tomasz-blasz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, mock classes for testing purposes cannot exist at application level AND application classes cannot inherit from them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants