我将 Swift 与 Typhoon 和 Cocoapods 一起使用。在我开始为我的 Typhoon 组件编写集成测试(根据Typhoon-Example-App Test )之前,一切都运行良好。我想以 与TyphoonFactory
在. 当我执行测试时,我总是得到一个setUp()
AppDelegate
TyphoonBlockComponentFactory assertIsAssembly:] + 244: 错误: MyApp.MyAssembly 不是 TyphoonAssembly 的子类
Typhoon 引发的错误(它正在使用kindOfClass
引擎盖下的方法。)相同的代码在其中完美运行AppDelegate
,我无法弄清楚出了什么问题。
为了验证这种行为,我isKindOfClass
在展位类中实现了检查(参见下面的代码):
- AppDelegate ->真
- 我的组件测试->假
有人可以进一步帮助我吗?多谢!
播客文件
inhibit_all_warnings!
target "MyApp" do
pod 'Typhoon', '2.1.0'
end
target "MyAppTests" do
pod 'Typhoon', '2.1.0'
end
MyAssembly.swift
public class MyAssembly : TyphoonAssembly{
//Some definitions
}
AppDelegate.swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
…
var assembly : MyAssembly = MyAssembly()
//Always returns „true“
println("Is type of class: \(assembly.isKindOfClass(TyphoonAssembly))")
…
}
MyComponentTest.swift
import XCTest
import MyApp
class MyComponentTest: XCTestCase {
override func setUp() {
super.setup()
var assembly : MyAssembly = MyAssembly()
//Always returns „false“!
println("Is type of class: \(assembly.isKindOfClass(TyphoonAssembly))")
//Error is thrown „MyApp.MyAssembly is not a sub-class of TyphoonAssembly“
var factory : TyphoonComponentFactory = TyphoonBlockComponentFactory(assembly: assembly) as TyphoonComponentFactory
}
}