When testing your views contained in a UIStoryboard
, make sure that you've added your storyboard file to the test target.
I'd also suggest that you have a test that validates that your storyboard was successfully initialized like this:
- (void)testStoryboardShouldBeInitialized
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"NameOfStoryboard" bundle:[NSBundle bundleForClass:[self class]]];
STAssertNotNil(storyboard, nil);
}
Edit
You first have to instantiate your view controller you'd like to test from your storyboard and then you can test your outlet:
UIViewController *controller = [storyboard instantiateViewControllerWithIdentifier:@"ViewControllerIdentifier"];
[controller view];
GHAssertTrue(controller.myView.isHidden, nil);
I'd also recommend to test (in a separate method) that your view controller is successfully instantiated. I'd also move the controller initialization into your setUp method - if necessary.