oppia / oppia-android

A free, online & offline learning platform to make quality education accessible for all.
https://www.oppia.org
Apache License 2.0
300 stars 502 forks source link

[BUG]: Some tests on the LoggingIdentifierControllerTest file are false positives #5399

Closed kkmurerwa closed 1 month ago

kkmurerwa commented 1 month ago

Describe the bug

Tests in the test file that involve restarting the app and checking if the value generated is the same will always pass because of how the test file is set up. The LoggingIdentifierControllerTest initializes with the applicationIdSeed of 1L and on restart, this is the same seed used to generate the IDs and as such, any ID generated with the same seed will always be the same. Tests affected by this issue include the;

Two new test also needs to be introduced to ensure that the ID generated for the sessionID and the appSessionId values change when the app is restarted.

Steps To Reproduce

N/A

Expected Behavior

I expect that when the app restart is simulated, the applicationSeedId should be varied or modified on the restart to ensure that generated IDs are not the same purely on the basis of being generated with the same seed ID but because the IDs are being cached by the app itself. In the instance of the appSessionId, the ID should be different on each app restart in the tests to test the expected behaviour of the ID.

Screenshots/Videos

No response

What device/emulator are you using?

No response

Which Android version is your device/emulator running?

No response

Which version of the Oppia Android app are you using?

No response

Additional Context

No response

BenHenning commented 1 month ago

This was a very good call-out. I sent a PR to fix these tests, and fortunately the controller is behaving as expected (so there were no bugs to address, only incorrect tests + new tests to add).