去寫作的iOS應用程序的測試我想寫基礎上,iPhoneUnitTests蘋果開發站點例子爲我的應用中的一些應用測試。特別是我在通過應用程序中的元素「點擊」時遇到問題,也就是模擬使視圖控制器看起來消失的點擊調用方法。,圍繞應用
比如我有這樣的測試:
- (void)testAddMeal
{
HomeScreenController *hsCtrl = (HomeScreenController*)mainViewController;
[hsCtrl tableView:hsCtrl.tblView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
nutritionStrategyController = (NutritionStrategyController*)((UINavigationController*)mainViewController.modalViewController).topViewController;
[nutritionStrategyController tableView:nutritionStrategyController.tblView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]];
}
打開一個第一UIViewController中選擇一個表格單元格,然後第二個UIViewController中應該出現在新的UIViewController中選擇一個表格單元格。 問題是,測試失敗,此錯誤:
Unknown.m:0: error: -[NutritionStrategyTests testAddMeal] : Attempting to begin a modal transition from <UINavigationController: 0x113a2fc0> to <NewMealTrackingController: 0x9353090> while a transition is already in progress. Wait for viewDidAppear/viewDidDisappear to know the current transition has completed
所以我的問題是,我該如何創建這樣的測試?