我是UI测试的新手,正在尝试将该功能集成到现有项目中。我正在尝试最基本的测试,只是看到框架在行动,但我遇到了一些困难。我已经为我的项目添加了一个新的UI Testing Bundle目标,并且能够运行我的基本测试。但是,当我尝试在我的测试中实际启动应用程序时,我总是会遇到“尝试启动失败”错误。它还说明了“当前流程参考的零令牌”。
这是我正在测试的代码:
@implementation SKYPracticeUITesting
- (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 *app = [[XCUIApplication alloc] init];
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
[app launch];
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
NSLog(@"Something is happening");
}
@end
非常感谢任何帮助,特别是考虑到Objective-C中的过程没有很好地记录。