pgum/Nokia-PK-2021

Simulation of a button press

Closed this issue · 2 comments

Koci0 commented
  • Problem description
    Because of lambda expressions in the ConnectedState.cpp we are unable to test the transition from the Connected to the Talking state. The only solution to our problem is an accept button click simulation, which is possible in the QTest framework. Is there a similar way in GoogleTest or another approach to this state transition?
  • Logs/console output
    Logs of current test:
(...) --gtest_filter=ApplicationConnectedTestSuite.shallSendRejectCallResponseMessage:ApplicationConnectedTestSuite/*.shallSendRejectCallResponseMessage:*/ApplicationConnectedTestSuite.shallSendRejectCallResponseMessage/*:*/ApplicationConnectedTestSuite/*.shallSendRejectCallResponseMessage --gtest_color=no
(...)

(...):56: EXPECT_CALL(timerPortMock, startTimer(500ms))...
  Expected arg #0: is equal to 8-byte object <F4-01 00-00 00-00 00-00>
           Actual: 8-byte object <30-75 00-00 00-00 00-00>
         Expected: to be called once
           Actual: called once - saturated and active
  • Code snippet or link to code
    Code committed in the abea3c0
  • Reference to documentation
    Paragraph 4.1.6, mainly two user options - accept and reject

No, it is not possible to have any connection to Qt in your tests or code.
The fact that ApplicationEnvironment is implemented with Qt - is just an implementation detail.
Look at this from the following perspective: it should be possible to change the implementation of ApplicationEnvironment from Qt - to e.g. https://en.wikipedia.org/wiki/WxWidgets WITHOUT any changes in your Application code. And all of the above is present in the specification (2: UE Basic Information):

⦁ QtApplicationEnvironment: implementation library
⦁ It is just one of possible implementation of ApplicationEnvironment

It is important:
⦁ Not to use Qt library in Application directly
⦁ Not to add anything new to ApplicationEnvironment

What you can use in your Application states is to communicate with User (User Interface) with this interface - https://github.com/Koci0/Nokia-PK-2021/blob/abea3c0feb7b568919f7a93a6239626587f87498/UE/ApplicationEnvironment/IUeGui.hpp and all its sub-interfaces.

Actually you should enclose all interactions with User(IUeGui) in UserPort object. And Apllication object shall only interact with UserPort via IUserPort and IUserEventsHandler. This should be done in the same way as BtsPort is separating Application from ITransport interface.

Koci0 commented

After some more work I think I managed to resolve my problem in 5aee532. Thank you for the help, I am closing this issue.