AgoraIO-Extensions / Agora-Flutter-SDK

Flutter plugin of Agora RTC SDK for Android/iOS/macOS/Windows

Home Page:https://pub.dev/packages/agora_rtc_engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tests failing cus of error: type 'MockRtcEngine' is not a subtype of type 'RtcEngineImpl' in type cast

lewooz opened this issue · comments

Before v6.2.3 I could easily mock RtcEngine class and run tests but after updating to the most recent version my tests are no longer working. This is the error I am getting:

image

I am using mocktail package to mock RtcEngine and stub it's methods. When I downgrade to 6.2.2 everything works fine.

Any help would be greatly appreciated.

The createAgoraRtcEngine returns the RtcEngineImpl underlying

return impl.RtcEngineImpl.create();

How does your test case look like, maybe it's not a good way to mock the RtcEngine interface if your test case is combined with the AgoraVideoView.

I am getting the error when each widget test is finished which means I am getting the error only when the AgoraVideoView is getting disposed. This is how I am mocking the RtcEngine:
image

As I said I am not having issues with 6.2.2. A change made in 6.2.3 is the cause of the issue. My hunch is that the problem might be happening because extension methods can not be stubbed.

If the rendering is not a matter of your test, I think you'd better mock VideoViewController and pass it to your AgoraVideoView implementation.

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please raise a new issue.