1
我實際上是試圖在我的應用程序中使用靈活快照實現UI測試。 我正面臨一個我並不真正瞭解的問題。 我一直在環顧四周,但似乎沒有找到我的問題的答案。架構x86_64的未定義符號測試我的ViewController Swift
當我嘗試實例化我的viewcontroller以嘗試並測試與其關聯的視圖時,會發生我的問題。編譯總是失敗,並顯示此錯誤消息。
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)
我的測試代碼如下所示:
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()
}
}
}
}
是相當新的UI測試中,我真的不明白是什麼原因造成了這個問題。 任何幫助或提示將不勝感激如何解決這個問題或改善我的UI測試代碼。
預先感謝您。
Martin
檢查您的視圖控制器是否在您的測試的目標成員資格中被選中(打勾)。 –
你看到這個錯誤爲鏈接錯誤嗎? –
@BadhanGanesh這是否意味着我必須將我的項目的所有文件添加到我的ui測試的目標成員中?我雖然「可測試」會做到這一點,並讓我訪問我的項目的元素。 – Martin