Skip to content

WIP: Simple test suite for StreamsModel.

Shivansh Saini requested to merge shivanshs9/vlc-android:test-streams into master

Hi all, This MR brings some progress to #793 (closed), as my first attempt at implementing a test suite for some classes.

So far, I've solved #181 (closed) while getting familiar with the codebase. I've also been practising with Mockito and trying to implement one unit test to see how exactly native method calls can be handled here. I'm on my way to learning Roboelectric to atleast simplify the process to writing tests and not having to mock every method implemented by android.jar.

In this MR, I had to:

  • fix up some old test classes to pass the build.
  • add an optional overriding coroutine context in StreamsModel, so that tests can make do without the Android Main Looper.
  • write just 2 tests for StreamsModel to test the state of history in case of:
    1. failed initialization of Medialibrary.
    2. getting two media streams
  • included livedata testing library, to allow for human-friendly assertion syntax for livedata.
  • updated PowerMock to v2.0.0, certain functionalities weren't working fine due to updated API of Mockito (such as mocking static methods).
Edited by Shivansh Saini

Merge request reports