Mar*_*tin 3 xcode ios swift swift4 xcode9
我实际上是在尝试使用灵活快照在我的应用程序中实现 UI 测试。我正面临一个我不太了解的问题。我一直在环顾四周,但似乎没有找到我的问题的答案。
当我尝试实例化我的视图控制器以尝试测试与其关联的视图时,我的问题出现了。编译总是失败并显示此错误消息。
Undefined symbols for architecture x86_64:
"__T06medici19LoginViewControllerCMa", referenced from:
__T013mediciUITests13LoginViewTestC4specyyFyycfU_yycfU_ in
testUILogin.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
我的测试代码如下所示:
import Nimble
import Nimble_Snapshots
import Quick
import UIKit
@testable import XXXXMyProject
class LoginViewTest: QuickSpec {
override func spec() {
describe("LoginView") {
var vcLogin: LoginViewController!
beforeEach {
let storyboard = UIStoryboard(name: "Account", bundle: nil)
vcLogin = storyboard.instantiateViewController(withIdentifier: "LoginViewController") as! LoginViewController
_ = vcLogin.view // To call viewDidLoad
}
it("has a valid snapshot") {
expect(vcLogin.view) == recordSnapshot()
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
作为 UI 测试的新手,我真的不明白是什么导致了这个问题。关于如何解决此问题或改进我的 ui 测试代码的任何帮助或提示将不胜感激。
先感谢您。
马丁