xctest

How to test a sendAsynchronousRequest: on XCTest

你。 提交于 2020-01-20 17:57:25
问题 Sorry for the noob question, but I'm trying to test a connection, but I'm not able do verify the return of the request, because the test ends before the completion handler have a chance to execute. To ilustrate: -(void)testConnection { [[Conector sharedInstance] performAsynchronousRequestWithServerRequest:_srvRequest completionHandler:^(RequestAsynchronousStatus finishStatus, NSData *data) { if (finishStatus == RequestAsynchronousOK){ _data = data; NSLog(@"Data OK"); } }]; XCTAssertNotNil(

How to test a sendAsynchronousRequest: on XCTest

给你一囗甜甜゛ 提交于 2020-01-20 17:54:19
问题 Sorry for the noob question, but I'm trying to test a connection, but I'm not able do verify the return of the request, because the test ends before the completion handler have a chance to execute. To ilustrate: -(void)testConnection { [[Conector sharedInstance] performAsynchronousRequestWithServerRequest:_srvRequest completionHandler:^(RequestAsynchronousStatus finishStatus, NSData *data) { if (finishStatus == RequestAsynchronousOK){ _data = data; NSLog(@"Data OK"); } }]; XCTAssertNotNil(

Xcode Framework: Umbrella header for module 'Test' does not include header 'NewTest.h'

时光总嘲笑我的痴心妄想 提交于 2020-01-16 03:38:23
问题 framework module Test { umbrella header "Test.h" export * module * { export * } } This is what my module file looks like. How can I resolve the following warning. Umbrella header for module 'Test' does not include header 'NewTest.h' I am not familiar with module files. 回答1: You should have a module map modify the code to- framework module Test { umbrella header "Test.h" export * module * { export * } explicit module BFAppLinkResolving { header "BFAppLinkResolving.h" link "BFAppLinkResolving"

What is the replacement for XCTAssertEqualObjects?

人走茶凉 提交于 2020-01-16 01:19:32
问题 Not sure exactly when but at least as of Xcode 7.2, XCTAssertEqualObjects is no longer available. Is there a replacement for this without having to resort to? XCTAssertTrue(foo == bar) Note that Apple's "Writing Test Classes and Methods" appears out of date and still refers to the missing class. 回答1: I would be a bit more specific about what you are testing. Equality and identity are not the same thing, especially in Swift where there are far richer value types. If you want to test equality

UI testing failure - did not receive view did disappear notifications within 2.0s error

断了今生、忘了曾经 提交于 2020-01-15 05:09:10
问题 I am writing my test suite UI automation with xcode 8. However I keep occurring into this problem while trying to dismiss alerts. I am currently using the addUIInterruptionMonitor in order to dismiss my alerts, however when I call the interruption monitor to fire using app.tap() I get the error UI testing failure - did not receive view did disappear notifications within 2.0s error Why is this happening and how can I prevent this from happening? Attached is my start up code for the app

Why this line is not covered? Xcode code coverage

元气小坏坏 提交于 2020-01-14 09:51:49
问题 I'm experiencing an issue with the report of code coverage in Xcode. As you can see from this screenshot: On the left tab, line 58 is "touched" from the break-point, and on the right tab, the test passes. While on the right tab, I'm running only the test on line 37. Why does Xcode sign the line 58 in red, as not covered? Line 53 is not "touched" (if I set a break-point there). Using SQLite as a database. The entire project is available here. EDIT : Adding code: Test.swift func testAddFuelFail

Automatically Running a Test Case Many Times in Xcode

泄露秘密 提交于 2020-01-13 08:46:40
问题 In Xcode, is there a way for me run a single test case n times automatically? Reason for doing this is that some of my beta testers are encountering random crashes in my app. I see the crash logs in TestFlight, along with the stack trace, but I can't reproduce the crash. The crash happens infrequently but when it does, it always happens when users are trying to create a DB record, which then gets uploaded to a server. The problem with the crash logs is that my code does not make an appearance

Xcode Unit Tests: Xcode doesn't stop at breakpoints

末鹿安然 提交于 2020-01-13 07:54:08
问题 Using Xcode 6.3 Beta 2 with Units Tests I have the following problem: When I do unit testing the breakpoints in the unit-test module work but the break codes in the code under test don't are ignored. Any ideas? 回答1: I had the same issue and the reason was the scheme settings: 1.- Edit your scheme 2.- Choose "Test" in the left panel 3.- Check the "Debug executable" option That was all. 回答2: Simple point to check even if this post is quite old: Does your Test-Method start with the prefix "test"

Scheme language setting ignored in iOS unit and ui tests

做~自己de王妃 提交于 2020-01-12 13:03:03
问题 My final goal is to issue xcodebuild test from command line picking different schemes for different languages. Currently I have two schemes, the only difference between them is the application language. In one scheme it is English, in the other is Spanish. If I use xCode to run the application it works nice, it is launched with the language specified in the scheme I have picked, both EN or ES are okay. If I run the tests from xCode, language setting is ignored. Whichever scheme I pick, it

Scheme language setting ignored in iOS unit and ui tests

房东的猫 提交于 2020-01-12 13:02:52
问题 My final goal is to issue xcodebuild test from command line picking different schemes for different languages. Currently I have two schemes, the only difference between them is the application language. In one scheme it is English, in the other is Spanish. If I use xCode to run the application it works nice, it is launched with the language specified in the scheme I have picked, both EN or ES are okay. If I run the tests from xCode, language setting is ignored. Whichever scheme I pick, it