xctest

How To Link XCTest Dependency To Production / Main Target?

走远了吗. 提交于 2019-11-30 22:41:41
I am trying to write an extension for the XCTest framework in Swift. In order to do so, I created a project with two targets: the main/production target and a test target. As I am writing an extension for XCTest, I need to import XCTest within my main/production target as well. However, I am having trouble to do so. When in Xcode and I click on my project, then select the main target, go to Build Phases, Link Binary With Libraries and add XCTest there, I get a compile error: ld: framework not found XCTest clang: error: linker command failed with exit code 1 (use -v to see invocation) I also

XCTest - “Test failed”

喜夏-厌秋 提交于 2019-11-30 19:32:35
I'm trying to add tests to a mac app. I'm using XCTest framework. When i run tests (cmd + U) i receive "Test failed" and in console I see : 2013-10-15 13:22:56.354 8tracks Radio[40560:303] Error loading /Users/victor/Library/Developer/Xcode/DerivedData/Musica-dhxbqwburbddtietormguodcwoqt/Build/Products/Test/MusicaTests.octest/Contents/MacOS/MusicaTests: dlopen(/Users/victor/Library/Developer/Xcode/DerivedData/Musica-dhxbqwburbddtietormguodcwoqt/Build/Products/Test/MusicaTests.octest/Contents/MacOS/MusicaTests, 262): no suitable image found. Did find: /Users/victor/Library/Developer/Xcode

Performing UIAccessibilityCustomAction from UITests

徘徊边缘 提交于 2019-11-30 19:20:33
问题 I've got a subclass of UIView, let's say it's class DemoView: UIView { } which contains UILabel and UIButton. I needed to group it and add UIAccessibilityCustomAction so I've overriden the var accessibilityElements: [Any]? and used union to connect both elements. I've also assigned "Users" string to accessibilityLabel . From user perspective this works as it should, VoiceOver reads Users and then user can select custom action which is named Edit . Problem is that I don't know how can I fire

How to test UIImageView elements in iOS XCTest?

时间秒杀一切 提交于 2019-11-30 19:18:10
I'm trying to test my UIs using XCTest UI testing, and having troubles of testing UIImageViewsI have in my app (hit tests, presence etc). In the list of the XCUIElementType there is no such type, and when I look at the children of the superview my UIImageViews are not listed there for some reason eventhough I can see them on screen and in the UI inspector in the Xcode. Has anyone had this kind of problem? Joe Masilotti Assert the presence of an image by its accessibility label. Production Code let image = UIImage(named: "profile") let imageView = UIImageView(image: image) imageView

Accessing user defined variables passed in from xcodebuild command line

China☆狼群 提交于 2019-11-30 17:53:25
I am running my xctests using xcodebuild and need to pass in some environment variables . In the example below ACCOUNT_ID and HOST_URL . I tried passing in the variables as both environment variable and accessing them from the test using getenv ("ACCOUNT_ID") xcodebuild -project CalculatorTestClient.xcodeproj -scheme CalculatorTestClient -destination '%s' ACCOUNT_ID=%s HOST_URL=%s test" And passing them in as user defaults and accessing them using [[NSUserDefaults standardUserDefaults] valueForKey:@"HOST_URL"]; xcodebuild -project CalculatorTestClient.xcodeproj -scheme CalculatorTestClient

How To Link XCTest Dependency To Production / Main Target?

南楼画角 提交于 2019-11-30 17:53:09
问题 I am trying to write an extension for the XCTest framework in Swift. In order to do so, I created a project with two targets: the main/production target and a test target. As I am writing an extension for XCTest, I need to import XCTest within my main/production target as well. However, I am having trouble to do so. When in Xcode and I click on my project, then select the main target, go to Build Phases, Link Binary With Libraries and add XCTest there, I get a compile error: ld: framework not

@try/@catch doesn't catch exception

♀尐吖头ヾ 提交于 2019-11-30 15:56:45
问题 After upgrading Xcode from 6.0 to 6.3, I noticed my automated tests started failing. 2015-04-14 18:56:50.625 xctest[48304:517820] *** Terminating app due to uncaught exception 'foo', reason: 'bar' *** First throw call stack: ( 0 CoreFoundation 0x0084a746 __exceptionPreprocess + 182 1 libobjc.A.dylib 0x004d3a97 objc_exception_throw + 44 2 CoreFoundation 0x0084a66d +[NSException raise:format:] + 141 3 TestTests 0x03e6dbdc -[TestTest test] + 810 4 CoreFoundation 0x0072b84d __invoking___ + 29 5

@try/@catch doesn't catch exception

笑着哭i 提交于 2019-11-30 15:32:34
After upgrading Xcode from 6.0 to 6.3, I noticed my automated tests started failing. 2015-04-14 18:56:50.625 xctest[48304:517820] *** Terminating app due to uncaught exception 'foo', reason: 'bar' *** First throw call stack: ( 0 CoreFoundation 0x0084a746 __exceptionPreprocess + 182 1 libobjc.A.dylib 0x004d3a97 objc_exception_throw + 44 2 CoreFoundation 0x0084a66d +[NSException raise:format:] + 141 3 TestTests 0x03e6dbdc -[TestTest test] + 810 4 CoreFoundation 0x0072b84d __invoking___ + 29 5 CoreFoundation 0x0072b6f8 -[NSInvocation invoke] + 360 6 XCTest 0x20108975 -[XCTestCase invokeTest] +

Testing UIWebView with Xcode UI Testing

谁说我不能喝 提交于 2019-11-30 12:02:40
I'm using new Xcode UI Testing from XCTest Framework with the Xcode 7 GM . I've got an app with simple UIWebView (it's just a navigation controller + view controller with web view and button) and I want to check following scenario: Web View loads page www.example.com User taps on button Web View loads some page with URL: www.example2.com I want to check which page is loaded in UIWebView after pressing button. Is this possible with UI Testing right now? Actually I'm getting web view like this: let app:XCUIApplication = XCUIApplication() let webViewQury:XCUIElementQuery = app

Ordering unit test using XCTest in Xcode 6

你。 提交于 2019-11-30 11:49:48
问题 I would like to know if there is any way to tell Xcode to run unit tests in a specified order. I mean not in a same XCTestCase class file, but between all the class file. For example I want to run the SitchozrSDKSessionTest before running SitchozrSDKMessageTest. I looked over few threads on stack or on Apple documentation and I haven't found something helpful. Thanks for your help. 回答1: It's all sorted alphabetically (classes and methods). So when You need some tests running last, just change