3

我正在查看 WWDC 2015 session 104 “What's new in Xcode”,并看到在 Xcode 7 中我可以记录界面单元测试以自动单击按钮、输入文本等。

我创建了一个包含 UITests 的新项目,但我如何真正开始记录 UITests 的界面交互?

这是测试中包含的代码段:

- (void)setUp {
    [super setUp];

    // Put setup code here. This method is called before the invocation of each test method in the class.

    // In UI tests it is usually best to stop immediately when a failure occurs.
    self.continueAfterFailure = NO;
    // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
    [[[XCUIApplication alloc] init] launch];
}
4

1 回答 1

10

记录按钮是主文本编辑器左下角的红色按钮。当您不在可以录制的方法中时,该按钮将显示为灰色。

Xcode UI 测试记录按钮

于 2015-08-27T18:59:37.153 回答