Xcode 7 UI Testing Target Locale and Region Settings

I am trying to set the language and scope of my user interface testing target, and unfortunately it does not work.

I tried both ways, first:

  • Product | Scheme | Change Scheme
  • Run | Options
    • Application Language: French
    • Scope: France
  • Test | the arguments
    • Use the Take Action arguments and environment variables: Checked

And I try differently:

  • Product | Scheme | Change Scheme
  • Test | the arguments
    • Use the Take Action arguments and environment variables: Unchecked
    • Arguments passed at startup:
      • -AppleLanguages (French)
      • -AppleLocale fr_FR

Each method that leads to user interface testing still happens in English. Moreover, when I press the record button, it works in French ...

So, if I do something wrong, I would be happy to know!

Thanks in advance!

+7
ios xcode localization xcode-ui-testing ui-testing
source share
2 answers

I get it. I set the locale settings in the startArguments parameters for temporary testing in Xcode.

 override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false app = XCUIApplication() app.launchArguments = [ "-inUITest", "-AppleLanguages", "(de)", "-AppleLocale", "de_DE" ] 

For CI, I use fastlane from Felix Krause and get localized screenshots with a snapshot.

+8
source share

Try changing the specifications on the simulator. He worked for me every time.

In the simulator: Settings> General> Language and region> iPhone language → change here

0
source share

All Articles