Should I add items to my unit test that are already checked by a static analysis tool?

Viewed 63

I've been reading 'Test-Driven iOS Development' to brush up on my unit-testing skills. As I read some of the tests, some seem of questionable use. Indeed, there are some tests that duplicate warnings that Clang already issues to the code.

My question is, should I be spending time writing tests to cover these items?

Here's an example:

@interface NGAStackOverflowManager : NSObject

@property (weak) id<NGAStackOverflowManagerDelegate> delegate;

@end

In the book, there is a test to ensure that the delegate conforms to the NGAStackOverflowManagerDelegate protocol. As Clang will show warnings when analyzing the calling code, is it worth writing a test specifically for that?

In addition, is it worth writing tests for generated code? Here's an example:

@interface Thing : NSObject
@property (readwrite, retain) NSDate * date;
@end

@implementation Thing
@synthesize date;
@end

Is it worth testing the implementation of the date property since it's made completely of synthesized code?

1 Answers
Related