objective c - LCOV doesn't show some classes -
i have abstact uiviewcontroller has methods test.
@interface abviewcontroller : uiviewcontroller @property (nonatomic, strong) nsmutablearray *testresults; - (void)test; - (void)testfailedwithmessag:(nsstring *)message; @end @implementation abviewcontroller - (void)testfailedwithmessag:(nsstring *)message { if(self.testresults == nil) { self.testresults = [nsmutablearray array]; } [self.testresults addobject:message]; } @end
the basic idea of class test private methods not listed on .h.
the test routines implmented in subclass's "test" method. shown below.
rootviewcontroller subclass of abviewcontroller.
@interface rootviewcontroller () { uibutton *testbutton; } @end @implementation rootviewcontroller - (void)viewdidload { [super viewdidload]; testbutton = [[uibutton alloc] init]; } - (void)test { if(testbutton==nil) [self testfailedwithmessag:@"testbutton nil"]; } @end
xctest below.
- (void)testrootviewcontroller { // allocation class instance rootviewcontroller *testclassinstance = [[rootviewcontroller alloc] init]; // when [testclassinstance view]; // implement test [testclassinstance test]; // verify result xctasserttrue(([[testclassinstance testresults] count] == 0), @"%@", [[testclassinstance testresults] description]); }
i made several subclasses of abviewcontroller , ran unit test. lcov shows test coverage shows abviewcontroller.
i want see viewcontrollers in project. there way? number of functions not matching functions of viewcontrollers. why?
Comments
Post a Comment