Unit Testing iPhone Code That Uses NSLocalizedString

Posted by Jay Haase on Stack Overflow See other posts from Stack Overflow or by Jay Haase
Published on 2010-09-30T17:18:15Z Indexed on 2011/02/18 15:25 UTC
Read the original article Hit count: 273

Filed under:
|
|
|

I have an iPhone iOS4.1 application that uses localized strings. I have just started building unit tests using the SenTestingKit. I have been able to successfully test many different types of values.

I am unable to correctly test any of my code that uses NSLocalizedString calls, because when the code runs in my LogicTests target, all of my NSLocalizedString calls only return the string key.

I have added my Localizable.strings file to the LogicTests target.

My question is: How must I configure my LogicTests target so that calls to NSLocalizedString will return the localized string and not the string key.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about testing