これを達成するために実際に使用する必要があるのは SenTestingKit (必ずしも KIF である必要はありません) であるという質問をした後、私は気付きました。http://briancoyner.github.io/blog/2011/09/12/ocunit-parameterized-test-case/のソリューションのバリエーションを使用して、同じテスト方法と実行ごとに異なる値を使用して複数のテストを実行しました。
description
Xcode 5 のテスト ナビゲーターをサポートするメソッドを SenTestCase サブクラスに追加しました。1 つのテスト メソッドで、各パラメーター セットのテストの実行を確認できます。メソッドを変更することで、description
各実行に一意の名前を付けることができます。このアプローチは、リンク先のブログ投稿と似ていますが、ここで実装を提供します。
WMScenarioOutline.h
#import <KIF/KIF.h>
@interface WMScenarioOutline : SenTestCase
@property (nonatomic, copy) NSDictionary *example;
- (id)initWithInvocation:(NSInvocation *)anInvocation example:(NSDictionary *)example;
@end
WMScenarioOutline.m
#import "WMScenarioOutline.h"
@implementation WMScenarioOutline
+ (id)defaultTestSuite
{
SenTestSuite *testSuite = [[SenTestSuite alloc] initWithName:NSStringFromClass(self)];
[self addTestCaseWithExample:@{@"name" : @"Foo", @"value" : @0} toTestSuite:testSuite];
[self addTestCaseWithExample:@{@"name" : @"Bar", @"value" : @1} toTestSuite:testSuite];
return testSuite;
}
+ (void)addTestCaseWithExample:(NSDictionary *)example toTestSuite:(SenTestSuite *)suite
{
NSArray *testInvocations = [self testInvocations];
for (NSInvocation *testInvocation in testInvocations) {
SenTestCase *testCase = [[WMScenarioOutline alloc] initWithInvocation:testInvocation example:example];
[suite addTest:testCase];
}
}
- (id)initWithInvocation:(NSInvocation *)anInvocation example:(NSDictionary *)example
{
self = [super initWithInvocation:anInvocation];
if (self) {
_example = example;
}
return self;
}
- (void)testScenarioOutline
{
[tester runBlock:^KIFTestStepResult(NSError *__autoreleasing *error) {
NSLog(@"Testing example: %@", self.example);
return [self.example[@"value"] intValue] == 0 ? KIFTestStepResultSuccess : KIFTestStepResultFailure;
}];
}
- (NSString *)description
{
NSInvocation *invocation = [self invocation];
NSString *name = NSStringFromSelector(invocation.selector);
if ([name hasPrefix:@"test"]) {
return [NSString stringWithFormat:@"-[%@ %@%@]", NSStringFromClass([self class]), NSStringFromSelector(invocation.selector), self.example[@"name"]];
}
else {
return [super description];
}
}
@end

ここには改善の余地がたくさんありますが、ここから始めるのが良いでしょう。