xctest

can we check the validation of uitextfield while Unit Testing?

你。 提交于 2019-12-03 08:39:41
Suppose we have some validation in our ViewController ( say vc1 ) for a UItextfield in shouldChangeCharactersInRange method, as user only can enter the numbers not the alphabets or other special character. I just want to know that in our XCTestCase class, is this possible in unit testing, to check for a particular uitextfield , is allowing some characters (in my case only numbers) or not? Make unit tests that call shouldChangeCharactersInRange and check the expectation that the result should be true, or false. This is an example of how to unit test delegate methods. Where UIKit invokes a

Error loading XCTest, no suitable image found.

。_饼干妹妹 提交于 2019-12-03 08:22:02
问题 I have recently updated my Xcode and started having this error. 2014-11-03 15:03:54.222 App[13141:60b] Error loading /private/var/mobile/Applications/677127BD-5230-4D5F-B70E-AF728439D34B/tmp/AppTests.xctest/AppTests: dlopen(/private/var/mobile/Applications/677127BD-5230-4D5F-B70E-AF728439D34B/tmp/AppTests.xctest/AppTests, 262): no suitable image found. Did find: /private/var/mobile/Applications/677127BD-5230-4D5F-B70E-AF728439D34B/tmp/AppTests.xctest/AppTests: code signature invalid for '

Xcode Scheme Default Location is ignored in Tests

ぐ巨炮叔叔 提交于 2019-12-03 06:59:54
I've created a GPX file and added it to my project. If I have my project running, I can select the GPX file from the dropdown of possible locations to simulate and have it correctly apply the defined path. The project contains 2 schemes: the Main Scheme and the MainTest Scheme. I've set up both to use the GPX file as the "Default Location" on the "Options" tab. Further, Under the "Test" area of both schemes, I've specified the same file again. Main Scheme Run Options Main Scheme Test setup Test Scheme Run Options Test Scheme Test setup When I Run the app on a simulator, it correctly applies

iOS Automated Tests - XCTest vs Appium

最后都变了- 提交于 2019-12-03 05:47:14
I am looking for opinions from test engineers and iOS developers regarding a specific matter. I have been using Appium for over a year now, and I have come across various difficulties while running mobile web tests on real devices. Every time Apple makes changes in XCTest or Safari, Appium is directly impacted (even if they fix something, some other issue pops up in its place), and it has come to a point where I'm spending more time resolving Appium related issues as opposed to the ones from an AUT. Furthermore, you would need an Apple computer to develop and execute Appium iOS tests anyway.

Replicate pull to refresh in XCTest UI testing

戏子无情 提交于 2019-12-03 05:29:12
I am trying to replicate a pull to refresh on a UITableView using the new Xcode UI testing framework in Xcode 7 (beta 3) My current approach is dragging from the table to whatever element below the table I can find. This works when there is a fixed item below the table like a UIToolbar or UITabBar I would rather not rely on having a UITabBar or UIToolbar but I can't figure out a way to do the pull to refresh/drag action without using the method in XCUIElement . func pressForDuration(duration: NSTimeInterval, thenDragToElement otherElement: XCUIElement) But it fails when I don't have a toolbar

XCTests Failing on Physical Device: “Canceling tests due to timeout …”

。_饼干妹妹 提交于 2019-12-03 05:02:32
问题 XCTests are failing with the message: *** Canceling tests due to timeout in Waiting for test process to check in... This just started coming up in the last few days. I'm using Xcode 7.3.1, with iOS 9.3.2 running on an iPhone 6. My app is written mostly in Swift. I've seen some similar posts: Unable to run XCTests on iOS device iOS tests will not run on simulator when using Jenkins through JNLP Those other posts talk about this issue as arising with code signing. Code signing does not seem to

XCTestExpectation: how to avoid calling the fulfill method after the wait context has ended?

耗尽温柔 提交于 2019-12-03 04:53:56
问题 I’m using the new asynchronous testing capabilities of Xcode 6. Everything works fine when the asynchronous task ends before the timeout. But if the task takes longer than the timeout, things get more complicated. Here is how I’m doing my tests: @interface AsyncTestCase : XCTestCase @end @implementation AsyncTestCase // The asynchronous task would obviously be more complex in a real world scenario. - (void) startAsynchronousTaskWithDuration:(NSTimeInterval)duration completionHandler:(void (^)

How to write UI tests covering login with Facebook in Xcode?

不问归期 提交于 2019-12-03 03:42:44
I would like to write a UI test in Xcode covering a login with FBDSKLoginKit . However, Facebook iOS SDK uses SFSafariViewController presented to the user in order to authenticate her and unfortunately, there's no way how to interact with SFSafariViewController in UI tests in Xcode 7 . Any ideas how to test the facebook login without interacting with SFSafariViewController ? thexande Swift 3 Xcode 8 solution func testFacebookLogin() { let app = XCUIApplication() // set up an expectation predicate to test whether elements exist let exists = NSPredicate(format: "exists == true") // as soon as

Run XCTest bundle with simctl

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a XCTest bundle which I can run through xcode on a simulator by using simctl . I am using the iPhone 6 iOS 9.1 simulator with the following environment variables: export SIMCTL_CHILD_TestBundleLocation = "/Users/User/ios_app/DerivedData/primus/Build/Products/Debug-iphonesimulator/Tests.xctest" export SIMCTL_CHILD_XCInjectBundle = "/Users/User/ios_app/DerivedData/primus/Build/Products/Debug-iphonesimulator/Tests.xctest" export SIMCTL_CHILD_XCInjectBundleInto = "/Users/User/ios_app/DerivedData/primus/Build/Products/Debug

Unable to execute tests from command line via xcodebuild

你离开我真会死。 提交于 2019-12-03 01:34:41
I am trying to build and run test cases using command line for iOS test cases. I have given the following command: xcodebuild -target AppEngineTests -configuration Debug -sdk iphonesimulator TEST_AFTER_BUILD=YES clean build It builds the app but the testcases are not run. could someone please help? Thanks tooluser I've found the name property to require more specification. xcodebuild test -workspace #{WORKSPACE_FILE} -scheme #{TEST_SCHEME} -destination 'platform=iOS Simulator,name=iPhone Retina (4-inch),OS=7.0' Was what finally worked for me. iPhone was limited and/or unpredictable. As another