I would like to unit test if the custom cell is registered with the tableView.
-(void)viewDidLoad
{
[super viewDidLoad];
UINib *nib = [UINib nibWithNibName:@"FTStatsCellView" bundle:nil];
[[self tableView] registerNib:nib forCellReuseIdentifier:@"FTStatsCellView"];
}
Unit test:
-(void)testIfCustomCellsAreRegisteredToTable
{
[viewController viewDidLoad];
FTStatsCellView *cell = [[viewController tableView] dequeueReusableCellWithIdentifier:@"FTStatsCellView"];
XCTAssertNotNil(cell, @"Custom cell FTStatsCellView is not registered with the table.");
}
The test fails with the message:
[FTStatsViewControllerTests testIfCustomCellsAreRegisteredToTable] failed: Could not load NIB in bundle: 'NSBundle (loaded)' with name 'FTStatsCellView'
Any advice? thanks
Update
If I click on the project and change the test target's target from None to the application, then it works.

But this has the side effect that the app runs in the simulator each time I want to run a unit test.

Any advice?