简体   繁体   中英

iPhone unit test with iPhone setting parameters

I want to create an iphone unit test that tests my functions where it has used the device settings (for example Date and Time format for example 24/12h). How can I test this? How can I simulate the change of device settings?

I am not aware of any facility that allows you to programatically change the system settings. On the other hand, since date and time formats are dependent on the chosen locale it shouldn't be too hard to isolate your tests from the system local by providing your own locale in the tests.

Right now, the system locale is nothing else but an indirect input to your test. You should redirect all usages of the system locale (explicit and implicit) to your own wrapper. With this wrapper in place, you can control the locale used during test and in production.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM