hi, I need to write unit test cases for my views.Using some apple demo projects i learnt how to write a unit test case for simple functions(which includes mathematical logic like GCD,Prime etc). now i need to understand the same for Appdelegates and views.
so I need to know 1.how to start writing cases for delegates,views and learn the approach for the same. 2.any related demo projects or study guide for the same is appreciated.
please explain the approach for the code below:
//test suite
#import "SampleUnitTestCase.h"
#import "HelloWorldViewController.h"
#import "HelloWorldAppDelegate.h"
@implementation SampleUnitTestCase
- (void) setUp {
appDelegate = [[UIApplication sharedApplication] delegate];
viewController = appDelegate.viewController;
}
- (void) testAppDelegate {
STAssertNotNil(appDelegate, @"Cannot find the application delegate");
}
I am getting this errors
"((appDelegate) != nil)" should be true. Cannot find the application delegate in SampleUnitTestCase.m"
"Command /bin/sh failed with exit code 1"
//HelloWorldViewController.m file
#import "HelloWorldViewController.h"
@implementation HelloWorldViewController
- (IBAction)submitYourNamw
{
IblUserTypedName.text = txtUserName.text;
//NSLog(IblUserTypedName.text);
}
......
@end