我已經聲明瞭一個方法叫做按鈕狀態-(int)buttonstate;
沒有得到值xctest
在xctest.m
當我instansiate我的viewController和分配給一個int值我我得到錯誤的值。
-(int) buttonstate {
if ([searchButton isEnabled]) {
j = 1;
}
else
j = 0;
NSLog(@" j value is %d",j);
return j;
}
而在xctest .m文件
-(void) testwithoutData {
myapiViewController *apiViw = [[myapiViewController alloc]init];
int kn = [apiViw buttonstate];
NSLog(@"the value is %ld",(long)kn);
}
這兩種方法都在同樣的看法?並且你想在其他控制器中傳遞狀態值? – 2015-04-06 09:16:41
如果UITextField包含文本,那麼uiButton將啓用,值將爲1,我需要在xctest.m文件中的j值我得到的值爲0如果我運行測試之前視圖分配的值是1後,當我請參閱(int kn)它是0 – 2015-04-06 09:21:06
必須在調用buttonstate以在運行測試用例時看到值1之前,在testwithoutData中啓用serachButton。 – 2015-04-06 10:11:33