xctest

XCTest/XCTest.h not found on old projects built in Xcode 6

时光毁灭记忆、已成空白 提交于 2019-11-28 15:17:21
I have a few projects I'm trying to build with Xcode 6 Beta 2. The projects all have some type of library that uses XCTest (Kiwi/XCTest and Specta) that don't build in Xcode 6 because XCTest/XCTest.h cannot be found. fatal error: 'XCTest/XCTest.h' file not found #import <XCTest/XCTest.h> I noticed that XCTest.framework is no longer in the "Link Libraries with Binaries" build phase list, but that's fine because when I create a new project with Xcode 6 it appears the library is linked in automatically. Perhaps of some relevency, my XCTest-needing dependencies are all brought in via Cocoapods. Is

Swift TyphoonBlockComponentFactory Error in XCTest

社会主义新天地 提交于 2019-11-28 08:19:39
问题 i’m using Swift with Typhoon and Cocoapods. Everything worked well until i started to write an Integrationtest (according to the Typhoon-Example-App Test) for my Typhoon component. I wanted to setup the TyphoonFactory in the Test setUp() method in the same way as i did in the AppDelegate . When i execute the test i always get a TyphoonBlockComponentFactory assertIsAssembly:] + 244: ERROR: MyApp.MyAssembly is not a sub-class of TyphoonAssembly error thrown by Typhoon (wich is using the

Xcode 5.0.2 dyld: Library not loaded: @rpath/XCTest.framework/Versions/A/XCTest

自古美人都是妖i 提交于 2019-11-28 06:46:24
I have problems running a project in Xcode 5.0.2 I get the following error: dyld: Library not loaded: @rpath/XCTest.framework/Versions/A/XCTest Referenced from: /Users/chris/Library/Developer/Xcode/DerivedData/relatio-cwlmozvklaldmictbbjthzuoxnxz/Build/Products/Debug/relatio.app/Contents/MacOS/relatio Reason: image not found (lldb) How do I solve this issue? Robert Wagstaff It looks like your main target is linking to XCTest.framework as well as your test target. It should only be linked to the main target. 1) Go to Project settings 2) Go to your apps main target -> other linker flags 3)

Running individual XCTest (UI, Unit) test cases for iOS apps from the command line

こ雲淡風輕ζ 提交于 2019-11-28 05:19:54
Is it possible to run individual test cases, or individual test suites, from an iOS app test target, instead of all the test cases, from a command line interface? You can run tests from command line with xcodebuild , out of the box. When you do so, you run all of the test cases contained in the test target you've selected. You can also do so with scan from Fastlane, though I believe you're restricted to running all of the tests of the build scheme you select (as above), so it's not different from xcodebuild. You can run specific tests with xctool from Facebook, but it doesn't use xcodebuild,

iOS Unit Testing: Class is implemented in both

做~自己de王妃 提交于 2019-11-28 03:51:16
问题 I'm building an iOS 9 App with Swift 2 and Xcode 7. My app runs fine when deploying it to my phone but when I run any unit test, I get the following error message for a lot of classes: Class _TtC5<AppName>19<ClassName> is implemented in both /Users/<Username>/Library/Developer/CoreSimulator/Devices/<UUID>/data/Containers/Bundle/Application/<UUID</<AppName>.app/<AppName> and /Users/<Username>/<Path/To/Workspace>/DerivedData/<AppName>/Build/Products/Debug-iphonesimulator/<AppName>.xctest/

“XXX-Swift.h” file not found in test project

元气小坏坏 提交于 2019-11-28 01:10:34
问题 I'm trying to call a method of a NSObject subclass I have in the let's say "main" project within a method of a XCTestCase subclass in the test project. The NSObject subclass of the main project imports the "XXX-Swift.h" header file (I'm mixing Swift and Objective-C code). All works fine when I run the main project, but when I run the tests calling an object of that subclass, I get an error saying that the Swift header file in the import is not found. I guess I'm missing some settings in the

UI Testing Failure - Neither element nor any descendant has keyboard focus on TextView

瘦欲@ 提交于 2019-11-28 01:00:28
问题 I'm facing a problem with 'Textview' type field. I am unable to enter text in FeedbackTextView field. let FeedbackTextView = app.staticTexts["Feedback Textview"] FeedbackTextView.tap() FeedbackTextView.typeText("This is test feedback") Following error is displayed when above code is executed. UI Testing Failure - Neither element nor any descendant has keyboard focus. Element: 回答1: I faced this same problem with Xcode 7.0.1 and was able to resolve it by turning off the connected hardware

How to select a picker view item in an iOS UI test in Xcode?

无人久伴 提交于 2019-11-27 22:39:31
I have a picker view with few items: "Red", "Green", "Yellow", "Black". In my UI test I need to select a specific item "Green" from it. I am using the XCTest UI testing APIs that were intruduced with Xcode 7. What I managed to do so far is to swipe the whole picker view up in the unit test. It is not ideal because it always changes the picker view to the bottom item (when swiping up). let app = XCUIApplication() app.launch() app.pickers.elementAtIndex(0).swipeUp() XCTAssert(app.staticTexts["Selected: Black"].exists) Another but very similar way of changing the picker view is to call

Xcode7 | Xcode UI Tests | How to handle location service alert?

…衆ロ難τιáo~ 提交于 2019-11-27 18:32:15
I am writing UI Test Cases for one one of my app using the XCUIApplication, XCUIElement and XCUIElementQuery introduced in Xcode7/iOS 9. I have hit a road block. One of the screens in test case requires iOS's Location Services. As expected the user is prompted about allowing use of location service with alert titled: Allow “App name” to access your location while you use the app? with Allow & Don't Allow buttons. Problem is or so it seems that since the alert is presented by OS itself it is not present in Application's element sub-tree. I have logged following: print("XYZ:\(app.alerts.count)")

Is it possible to run XCTest tests in an iOS app?

早过忘川 提交于 2019-11-27 18:01:47
问题 We have a backend test suite written with XCTest. The suite runs great in Xcode, but for various reasons it would be nice for us if we could also run the suite in an iOS app. Is that possible? I don’t mind writing some glue code for it, but as it is I can’t even import the XCTest framework in a non-testing target: SomeController.swift:2:8: Cannot load underlying module for 'XCTest' 回答1: It is possible! The key is to get a copy of the XCTest framework linking and then use the public XCTest