我已经开始OCMock
为集成在项目工作区中的现有项目编写测试用例。完成此链接中提到的所有步骤之后。
当我第一次执行测试用例时,出现了上面的错误。我搜索了它,并尝试遵循一些解决方案,例如创建新目标,重新启动Xcode,但这并没有帮助我。任何的想法?
我已经开始OCMock
为集成在项目工作区中的现有项目编写测试用例。完成此链接中提到的所有步骤之后。
当我第一次执行测试用例时,出现了上面的错误。我搜索了它,并尝试遵循一些解决方案,例如创建新目标,重新启动Xcode,但这并没有帮助我。任何的想法?
Answers:
我在这里有关于Cocoapods和Carthage的笔记和演示应用程序https://github.com/onmyway133/TestTarget
Runpath Search Paths
指向$(FRAMEWORK_SEARCH_PATHS)
更多信息
$(FRAMEWORK_SEARCH_PATHS)
到Runpath Search Paths
我的工作。干杯!
Runpath Search Paths
指向对$(FRAMEWORK_SEARCH_PATHS)
我有帮助。
如果您使用的是CocoaPods,并且UI测试目标嵌入在应用程序目标中,那么可能还有另一种解决方案,不幸的是,默认模板(pod init
)中就是这种情况。
尝试将UI测试目标移出应用目标,如下所示:
从:
platform :ios, '11.0'
use_frameworks!
target 'MyApp' do
# Pods for MyApp
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
至:
platform :ios, '11.0'
use_frameworks!
# Pods shared between MyApp and MyAppUITests
target 'MyApp' do
# Pods for MyApp only
end
target 'MyAppUITests' do
# Pods for testing
end
信誉归功于此期主题中的SpacyRicochet:https://github.com/CocoaPods/CocoaPods/issues/4752#issuecomment-305101269
我的解决方案是在测试目标中添加“复制文件阶段”。在那里,我将目标设置为Frameworks,并用+号添加了我的框架。
只是分享我有关此错误的经验:
我正在使用fastlane + cocoapods。
我有一个带有2个动态框架的工作区:
依存关系:
依赖关系在Podfile中定义。
执行框架B测试时引发错误。
就我而言,问题与B.framework目标中缺少对AFNetworking的依赖关系有关。
在Podfile的B.framework中向AFNetworking添加一个pod依赖项,所有问题都已解决。
因此,即使目标B成功编译,AFNetworking也不会嵌入到B测试应用中,并且模拟器也无法运行B测试应用,从而引发此“非常有意义”(*)错误。
(*)感谢Apple!
在我的情况下,“仅构建活动架构”设置为“是”。
在项目和目标中:构建设置->体系结构->构建活动体系结构仅应为NO,而不是YES
I tried many different options but none helped me except below and wasted lot of time, posting this so that really help and save time on this:
Follow all of the instructions for Full Manual Configuration
https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md#full-manual-configuration
Tips
When you come to the part where you are executing xcodebuild, if the build fails, and the log mentions "RoutingHTTPServer" or "YYCache", add these two frameworks on the Build Phases tab of the WebDriverAgentRunner target
Open the WebDriverAgent.xcodeproj
Select 'Targets' -> 'WebDriverAgentRunner'
Open 'Build Phases' -> 'Copy frameworks'
Click '+' -> add RoutingHTTPServer
Click '+' -> add YYCache
https://github.com/facebook/WebDriverAgent/issues/902#issuecomment-382344697
https://github.com/facebook/WebDriverAgent/issues/902#issuecomment-383362376
The build/test may also fail due to the WebDriverAgentRunner app/developer being untrusted on the device. Please trust the app and try again.
While trying to access the WebDriverAgent server status, if it tries to connect on port 0, hardcode port 8100 in appium-xcuitest-driver/WebDriverAgent/WebDriverAgentLib/Routing/FBWebServer.m
Original line: server.port = (UInt16)port;
New line: server.port = 8100;
https://github.com/facebook/WebDriverAgent/issues/661#issuecomment-338900334
想分享我的答案,希望可以节省别人的时间。
对我来说.m文件在Build Phases-> Compile Sources下未正确链接
就我而言,我的Build Settings-> Architectures仅针对armv7进行设置,而我更改了ARCHS_STANDARD,与我的Host Application相同
就我而言,我有一个完全干净的项目,带有默认的空测试。如果我添加了任何Pod,则会收到此错误。解决方案是测试目标中至少一个文件应导入Foundation
import XCTest
import Foundation
@testable import CVZebra
class CVZebraTests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}