【发布时间】:2026-02-19 12:05:01
【问题描述】:
我正在测试一个别人写的计算器。我正在尝试使用 xcode 7 来测试所有基本功能。
这是我当前正在运行的不会失败的测试。我使用了新的录音功能来获得所有的按钮点击。但是,我不确定如何断言我返回的值是正确的。
- (void)testExample {
// Use recording to get started writing UI tests.
XCUIApplication *app = [[XCUIApplication alloc] init];
[app.buttons[@"6"] tap];
[app.buttons[@"+"] tap];
[app.buttons[@"3"] tap];
[app.buttons[@"="] tap];
//what the equation should return (9 in this case)
XCUIElement *display = app.staticTexts[@"199"];
XCTAssertTrue(display);
//what the equation should look like (6 + 3 in this case)
display = app.staticTexts[@"222+5553"];
XCTAssertTrue(display);
}
【问题讨论】:
标签: ios objective-c xcode-ui-testing