I have a UIViewController which has a property called persistentUserNames and i exposed this property to the XCTestClass using a category as follows. There is a method setupViews which is called on the viewDidLoad of the LoginViewController. This method initializes the array with some values.
@interface LoginViewController (Test)
@property (strong, nonatomic) NSArray *persistentUsernames;
@end
My test setup is as follows:
- (void)setUp {
[super setUp];
loginViewController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
[loginViewController view];
}
Following is my test case which fails for the reason i don't know:
- (void)testSetupLoginView {
//Given
loginViewController.persistentUsernames = nil;
//When
[loginViewController setupLoginView];
//Then
XCTAssertNotNil(loginViewController.persistentUsernames);
}
Help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire