我可以运行将我的应用程序置于后台的KIF测试吗?

时间:2015-05-13 20:32:35

标签: ios cocoa kif

我正致力于使用KIF为项目开发测试。我想知道是否有可能让KIF模拟按下主页按钮?是否也可以在此时模拟其他操作,例如启动命令中心或通知中心?

2 个答案:

答案 0 :(得分:3)

至少部分答案,请查看deactivateAppForDuration中的KIFTestActor.h

/*!
 @abstract Backgrounds app using UIAutomation command, simulating pressing the Home button
 @param duration Amount of time for a background event before the app becomes active again
 */
- (void)deactivateAppForDuration:(NSTimeInterval)duration;

答案 1 :(得分:1)

对于swift 3和Xcode 8,KIFSystemTestActor的这个功能起作用:

    system().deactivateApp(forDuration: 3)


    extension XCTestCase {    
            func system(_ file : String = #file, _ line : Int = #line) -> KIFSystemTestActor {
            return KIFSystemTestActor(inFile: file, atLine: line, delegate: self)
        }
    }
相关问题