Page MenuHomePhabricator

Update unit tests failing on non-English devices
Open, LowPublic

Assigned To
None
Authored By
Dmantena
Aug 7 2020, 12:33 AM
Referenced Files
F37095315: Screenshot 2023-06-06 at 11.06.12.png
Jun 6 2023, 9:10 AM
F37095314: Screenshot 2023-06-06 at 11.06.00.png
Jun 6 2023, 9:10 AM
F37095313: Screenshot 2023-06-06 at 11.06.27.png
Jun 6 2023, 9:10 AM
F31979142: tests2.png
Aug 7 2020, 12:33 AM
F31979143: tests1.png
Aug 7 2020, 12:33 AM

Description

I was running into strange unit test failures while testing a PR, failures unrelated to the PR work, and (eventually) realized it was related to the primary language of the Simulator I was running the tests on. Some of unit tests rely on English language strings and US region specific formatting to be considered successes.

I think at minimum for the time being we should at least document that the unit tests require the device's language/region to be en-US.

Repro Steps

  1. Set your device/Simulator's primary language to something other than English and region to something other than US in Settings > General > Language & Region (e.g. French/France)
  2. Run the app's unit tests against that Simulator

Expected Results
All tests succeed.

Actual Results
Some tests fail.

tests2.png (158×822 px, 159 KB)

tests1.png (710×832 px, 612 KB)

Event Timeline

LGoto lowered the priority of this task from Medium to Low.Sep 22 2020, 8:20 PM

@Tsevener
Hi everyone, i was thinking to fix this issue with the unit tests with the creation of a Localizable.strings in the test folder for each language and to introduce localization for strings the needs it for the test suit. This should resolve most of the test issues with the localization. I attach here some photos explaining how i would address this problem. Let me know if you consider it as a valuable solution, if so i could improve it for italian language and put in place the architecture. As a result only the new localization file would be needed to add in order to have test coverage in other languages.

Screenshot 2023-06-06 at 11.06.27.png (454×2 px, 90 KB)

Screenshot 2023-06-06 at 11.06.00.png (374×1 px, 50 KB)

Screenshot 2023-06-06 at 11.06.12.png (396×2 px, 239 KB)