xctest

How to test right-to-left language in iOS XCTest unit tests?

人盡茶涼 提交于 2021-02-18 22:22:48
问题 Is there a way to switch an XCTest unit test into the right-to-left mode to test Arabic version of the app where sentences are written from right to left of the screen? My app code logic behaves differently based on language direction. I would like to verify this functionality in a unit test. What I need to do is to switch the app into the right-to-left language mode from an XCTest unit test case. One can run the app in the right-to-left mode by changing the Scheme's Application language

Xcode 9 - Xcodebuild error - UI tests not running, Timed out waiting for AX loaded notification

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-10 04:12:46
问题 My tests do not start executing, and always timeout every time I try to use an xcodebuild command. The command that I used is the following: xcodebuild -workspace App.xcworkspace -scheme 'AppName' -sdk iphonesimulator -configuration 'UI_Automation' CODE_SIGN_STYLE='Manual' CODE_SIGN_IDENTITY='iPhone Developer: John Smith (XXXXXXXX)' PROVISIONING_PROFILE_SPECIFIER='John Smith PP Name' DEVELOPMENT_TEAM='ABC Company Apple DEV' -destination 'platform=iOS Simulator,name=iPhone 8,OS=11.2'

Xcode 9 - Xcodebuild error - UI tests not running, Timed out waiting for AX loaded notification

耗尽温柔 提交于 2021-02-10 04:11:57
问题 My tests do not start executing, and always timeout every time I try to use an xcodebuild command. The command that I used is the following: xcodebuild -workspace App.xcworkspace -scheme 'AppName' -sdk iphonesimulator -configuration 'UI_Automation' CODE_SIGN_STYLE='Manual' CODE_SIGN_IDENTITY='iPhone Developer: John Smith (XXXXXXXX)' PROVISIONING_PROFILE_SPECIFIER='John Smith PP Name' DEVELOPMENT_TEAM='ABC Company Apple DEV' -destination 'platform=iOS Simulator,name=iPhone 8,OS=11.2'

XCTestCase optional instance variable

拈花ヽ惹草 提交于 2021-02-07 08:11:39
问题 Why is my optional instance variable nil when I infact set it to non-nil? Code: class FooTests: XCTestCase { var foo: Int? func test_A_setFoo() { XCTAssertNil(foo) foo = 1 XCTAssertNotNil(foo) } func test_B_fooIsNotNil() { XCTAssertNotNil(foo) } } test_A_setFoo() succeeds while test_B_fooIsNotNil() fails 回答1: From Flow of Test Execution (emphasis added): For each class, testing starts by running the class setup method. For each test method, a new instance of the class is allocated and its

XCTestCase optional instance variable

▼魔方 西西 提交于 2021-02-07 08:09:56
问题 Why is my optional instance variable nil when I infact set it to non-nil? Code: class FooTests: XCTestCase { var foo: Int? func test_A_setFoo() { XCTAssertNil(foo) foo = 1 XCTAssertNotNil(foo) } func test_B_fooIsNotNil() { XCTAssertNotNil(foo) } } test_A_setFoo() succeeds while test_B_fooIsNotNil() fails 回答1: From Flow of Test Execution (emphasis added): For each class, testing starts by running the class setup method. For each test method, a new instance of the class is allocated and its

iOS Testing: dispatch_once get called twice. First in App, second in Test. Problems with Observers

一曲冷凌霜 提交于 2021-02-06 03:48:11
问题 I have a singelton class which will be create in the app delegate. When i run XCTTests then its get create a second time. + (instancetype)urlSchemeManager { static dispatch_once_t onceToken; static UrlSchemeManager* _sharedInstance; dispatch_once(&onceToken, ^{ _sharedInstance = [UrlSchemeManager new]; }); return _sharedInstance; } This is resulting in two different instances. This was no problem if i just use it for unit test. But in the integration test, when i register an observer for

iOS Testing: dispatch_once get called twice. First in App, second in Test. Problems with Observers

烂漫一生 提交于 2021-02-06 03:47:55
问题 I have a singelton class which will be create in the app delegate. When i run XCTTests then its get create a second time. + (instancetype)urlSchemeManager { static dispatch_once_t onceToken; static UrlSchemeManager* _sharedInstance; dispatch_once(&onceToken, ^{ _sharedInstance = [UrlSchemeManager new]; }); return _sharedInstance; } This is resulting in two different instances. This was no problem if i just use it for unit test. But in the integration test, when i register an observer for

iOS Testing: dispatch_once get called twice. First in App, second in Test. Problems with Observers

邮差的信 提交于 2021-02-06 03:47:44
问题 I have a singelton class which will be create in the app delegate. When i run XCTTests then its get create a second time. + (instancetype)urlSchemeManager { static dispatch_once_t onceToken; static UrlSchemeManager* _sharedInstance; dispatch_once(&onceToken, ^{ _sharedInstance = [UrlSchemeManager new]; }); return _sharedInstance; } This is resulting in two different instances. This was no problem if i just use it for unit test. But in the integration test, when i register an observer for

iOS Testing: dispatch_once get called twice. First in App, second in Test. Problems with Observers

北城以北 提交于 2021-02-06 03:47:22
问题 I have a singelton class which will be create in the app delegate. When i run XCTTests then its get create a second time. + (instancetype)urlSchemeManager { static dispatch_once_t onceToken; static UrlSchemeManager* _sharedInstance; dispatch_once(&onceToken, ^{ _sharedInstance = [UrlSchemeManager new]; }); return _sharedInstance; } This is resulting in two different instances. This was no problem if i just use it for unit test. But in the integration test, when i register an observer for

iOS Testing: dispatch_once get called twice. First in App, second in Test. Problems with Observers

风流意气都作罢 提交于 2021-02-06 03:47:12
问题 I have a singelton class which will be create in the app delegate. When i run XCTTests then its get create a second time. + (instancetype)urlSchemeManager { static dispatch_once_t onceToken; static UrlSchemeManager* _sharedInstance; dispatch_once(&onceToken, ^{ _sharedInstance = [UrlSchemeManager new]; }); return _sharedInstance; } This is resulting in two different instances. This was no problem if i just use it for unit test. But in the integration test, when i register an observer for