xctest

XCTest - UI Testing with XCUIElement using pinch gesture on custom coordinates?

孤街浪徒 提交于 2021-01-28 11:28:35
问题 Let's say I've an app with an UI which looks kind of like the image below: Let's also say the blue view behaves like a map and the other colors are other interactable views. I need to do a XCTest where I need to "zoom out" on that blue view which I tired with pinchWithScale: [blueView pinchWithScale:0.5 velocity:-1]; Unfortunately that doesn't work because one of the red views or the violet view (which overlaps the blue view a tiny bit for shadow and corner reasons) gets triggered instead of

Accessing Bundle of main application while running XCTests

南笙酒味 提交于 2021-01-28 11:11:59
问题 In tests target -> General -> Testing: set Host Application to None , so that no app gets launched. But in that case I cannot use Bundle.main.resourcePath and access resources of my main application (in which some command files are included as resources and I need to run them using Process() ). Could anyone suggest a solution? 回答1: Bundle(identifier: "com.something.app") will get you the bundle for a specific bundle ID. The problem is that if your bundle ID changes for your main target this

Xcode - File is part of module, ignoring import

折月煮酒 提交于 2021-01-28 07:02:21
问题 I have existing iOS project, added Unit test target and created new test case file in tests folder. When i tried to import module i'm facing this issue. I referred the below stack overflow question but it did not solve my problem. Xcode - Test class File is part of module, ignoring import @testable import wl_pih // Error: File 'wl_pihTests.swifts' is part of module 'wl_pih'; ignoring import class wl_pihTests: XCTestCase { let loginController = INCLoginViewController() //Not accessable

Xcode 10 and super.tearDown

风格不统一 提交于 2021-01-27 05:45:40
问题 Since Xcode 10.1(maybe 10) when I create a Unit test file I don't have calls super.tearDown() and super.setUp() . I've not seen such changes in release notes. In documentation https://developer.apple.com/documentation/xctest/xctestcase/understanding_setup_and_teardown_for_test_methods are still here. So my question should I still write super.tearDown() and super.setUp()? class SomethingTests: XCTestCase { override func setUp() { // Put setup code here. This method is called before the

Xcode 10 and super.tearDown

♀尐吖头ヾ 提交于 2021-01-27 05:45:05
问题 Since Xcode 10.1(maybe 10) when I create a Unit test file I don't have calls super.tearDown() and super.setUp() . I've not seen such changes in release notes. In documentation https://developer.apple.com/documentation/xctest/xctestcase/understanding_setup_and_teardown_for_test_methods are still here. So my question should I still write super.tearDown() and super.setUp()? class SomethingTests: XCTestCase { override func setUp() { // Put setup code here. This method is called before the

How can I run my performance tests more than ten times?

故事扮演 提交于 2020-12-29 05:14:41
问题 By default Xcodes performance tests are run ten times and my result is the average of those ten tests. The problem is the averaged result varies considerably each time I run it so I have to run the test at least five times to get a converged result. This is both tedious and time consuming; is there a way to configure either XCode or the unit test itself to run more than ten times? 回答1: In the latest Xcode (11.0+) you don't need swizzling to change iterations count. Use the following function:

How can I run my performance tests more than ten times?

元气小坏坏 提交于 2020-12-29 05:12:49
问题 By default Xcodes performance tests are run ten times and my result is the average of those ten tests. The problem is the averaged result varies considerably each time I run it so I have to run the test at least five times to get a converged result. This is both tedious and time consuming; is there a way to configure either XCode or the unit test itself to run more than ten times? 回答1: In the latest Xcode (11.0+) you don't need swizzling to change iterations count. Use the following function:

How can I run my performance tests more than ten times?

*爱你&永不变心* 提交于 2020-12-29 05:12:41
问题 By default Xcodes performance tests are run ten times and my result is the average of those ten tests. The problem is the averaged result varies considerably each time I run it so I have to run the test at least five times to get a converged result. This is both tedious and time consuming; is there a way to configure either XCode or the unit test itself to run more than ten times? 回答1: In the latest Xcode (11.0+) you don't need swizzling to change iterations count. Use the following function:

How can I run my performance tests more than ten times?

ぃ、小莉子 提交于 2020-12-29 05:11:28
问题 By default Xcodes performance tests are run ten times and my result is the average of those ten tests. The problem is the averaged result varies considerably each time I run it so I have to run the test at least five times to get a converged result. This is both tedious and time consuming; is there a way to configure either XCode or the unit test itself to run more than ten times? 回答1: In the latest Xcode (11.0+) you don't need swizzling to change iterations count. Use the following function:

XCTest: running tests fails with Cycle inside X; building could produce unreliable results in project with CocoaPods and Carthage

こ雲淡風輕ζ 提交于 2020-12-13 03:39:56
问题 After upgrading my project to Xcode 12, the test suite stopped working. The tests target doesn't compile, fails with: Cycle inside <redacted>Tests; building could produce unreliable results. This usually can be resolved by moving the shell script phase '[CP] Embed Pods Frameworks' so that it runs before the build phase that depends on its outputs. Cycle details: → Target '<redacted>Tests' has copy command from '/Applications/Xcode12.app/Contents/Developer/Platforms/iPhoneSimulator.platform