From d8f0d8033881c86ed527306199e58bd8719929e4 Mon Sep 17 00:00:00 2001 From: Brian Nickel Date: Fri, 23 Aug 2013 10:42:45 -0700 Subject: [PATCH] Moved core functionality from KIFTestCase to SenTestCase (KIFAdditions). --- Additions/SenTestCase-KIFAdditions.h | 14 +++++++++++++ Additions/SenTestCase-KIFAdditions.m | 30 ++++++++++++++++++++++++++++ Classes/KIF.h | 2 ++ Classes/KIFTestCase.h | 4 ++-- Classes/KIFTestCase.m | 16 ++------------- KIF Tests/SystemTests.m | 2 +- KIF.xcodeproj/project.pbxproj | 8 ++++++++ 7 files changed, 59 insertions(+), 17 deletions(-) create mode 100644 Additions/SenTestCase-KIFAdditions.h create mode 100644 Additions/SenTestCase-KIFAdditions.m diff --git a/Additions/SenTestCase-KIFAdditions.h b/Additions/SenTestCase-KIFAdditions.h new file mode 100644 index 000000000..c86cb55d8 --- /dev/null +++ b/Additions/SenTestCase-KIFAdditions.h @@ -0,0 +1,14 @@ +// +// SenTestCase-KIFAdditions.h +// KIF +// +// Created by Brian Nickel on 8/23/13. +// +// + +#import +#import "KIFTestActor.h" + +@interface SenTestCase (KIFAdditions) + +@end diff --git a/Additions/SenTestCase-KIFAdditions.m b/Additions/SenTestCase-KIFAdditions.m new file mode 100644 index 000000000..a4d0b68f0 --- /dev/null +++ b/Additions/SenTestCase-KIFAdditions.m @@ -0,0 +1,30 @@ +// +// SenTestCase-KIFAdditions.m +// KIF +// +// Created by Brian Nickel on 8/23/13. +// +// + +#import "SenTestCase-KIFAdditions.h" + +@implementation SenTestCase (KIFAdditions) + +- (void)failWithException:(NSException *)exception stopTest:(BOOL)stop +{ + if (stop) { + [self raiseAfterFailure]; + } + [self failWithException:exception]; + [self continueAfterFailure]; +} + +- (void)failWithExceptions:(NSArray *)exceptions stopTest:(BOOL)stop +{ + NSException *lastException = exceptions.lastObject; + for (NSException *exception in exceptions) { + [self failWithException:exception stopTest:(exception == lastException ? stop : NO)]; + } +} + +@end diff --git a/Classes/KIF.h b/Classes/KIF.h index 8ec717390..ee4fe1e8c 100644 --- a/Classes/KIF.h +++ b/Classes/KIF.h @@ -11,3 +11,5 @@ #import "KIFTestCase.h" #import "KIFSystemTestActor.h" #import "KIFUITestActor.h" + +#import "SenTestCase-KIFAdditions.h" diff --git a/Classes/KIFTestCase.h b/Classes/KIFTestCase.h index ccb2ca5bd..d42d2bd34 100644 --- a/Classes/KIFTestCase.h +++ b/Classes/KIFTestCase.h @@ -8,9 +8,9 @@ // which Square, Inc. licenses this file to you. #import -#import "KIFTestActor.h" +#import "SenTestCase-KIFAdditions.h" -@interface KIFTestCase : SenTestCase +@interface KIFTestCase : SenTestCase - (void)beforeAll; - (void)beforeEach; diff --git a/Classes/KIFTestCase.m b/Classes/KIFTestCase.m index 8b17ca5c5..510d17ede 100644 --- a/Classes/KIFTestCase.m +++ b/Classes/KIFTestCase.m @@ -87,20 +87,8 @@ - (void)failWithException:(NSException *)exception stopTest:(BOOL)stop [waiter waitForTimeInterval:[[NSDate distantFuture] timeIntervalSinceNow]]; return; - } - - if (!stop) { - [self continueAfterFailure]; - } - [self failWithException:exception]; - [self raiseAfterFailure]; -} - -- (void)failWithExceptions:(NSArray *)exceptions stopTest:(BOOL)stop -{ - NSException *lastException = exceptions.lastObject; - for (NSException *exception in exceptions) { - [self failWithException:exception stopTest:(exception == lastException ? stop : NO)]; + } else { + [super failWithException:exception stopTest:stop]; } } diff --git a/KIF Tests/SystemTests.m b/KIF Tests/SystemTests.m index 4e085036d..c202d4198 100644 --- a/KIF Tests/SystemTests.m +++ b/KIF Tests/SystemTests.m @@ -8,7 +8,7 @@ #import -@interface SystemTests : KIFTestCase +@interface SystemTests : SenTestCase @end @implementation SystemTests diff --git a/KIF.xcodeproj/project.pbxproj b/KIF.xcodeproj/project.pbxproj index 994caa271..9aebd4a13 100644 --- a/KIF.xcodeproj/project.pbxproj +++ b/KIF.xcodeproj/project.pbxproj @@ -78,6 +78,8 @@ EBAE488217A460E50005EE19 /* NSError-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = EBAE488017A460E50005EE19 /* NSError-KIFAdditions.m */; }; EBAE488717A4E5C30005EE19 /* KIFTestStepValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = EBAE488517A4E5C30005EE19 /* KIFTestStepValidation.h */; settings = {ATTRIBUTES = (Public, ); }; }; EBAE488817A4E5C30005EE19 /* KIFTestStepValidation.m in Sources */ = {isa = PBXBuildFile; fileRef = EBAE488617A4E5C30005EE19 /* KIFTestStepValidation.m */; }; + EBAFFF3817C7C824003E3A1C /* SenTestCase-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = EBAFFF3617C7C824003E3A1C /* SenTestCase-KIFAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EBAFFF3917C7C824003E3A1C /* SenTestCase-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = EBAFFF3717C7C824003E3A1C /* SenTestCase-KIFAdditions.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -163,6 +165,8 @@ EBAE488017A460E50005EE19 /* NSError-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSError-KIFAdditions.m"; sourceTree = ""; }; EBAE488517A4E5C30005EE19 /* KIFTestStepValidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KIFTestStepValidation.h; sourceTree = ""; }; EBAE488617A4E5C30005EE19 /* KIFTestStepValidation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KIFTestStepValidation.m; sourceTree = ""; }; + EBAFFF3617C7C824003E3A1C /* SenTestCase-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SenTestCase-KIFAdditions.h"; sourceTree = ""; }; + EBAFFF3717C7C824003E3A1C /* SenTestCase-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SenTestCase-KIFAdditions.m"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -284,6 +288,8 @@ EBAE487B17A45A8E0005EE19 /* NSBundle-KIFAdditions.m */, EBAE487F17A460E50005EE19 /* NSError-KIFAdditions.h */, EBAE488017A460E50005EE19 /* NSError-KIFAdditions.m */, + EBAFFF3617C7C824003E3A1C /* SenTestCase-KIFAdditions.h */, + EBAFFF3717C7C824003E3A1C /* SenTestCase-KIFAdditions.m */, ); path = Additions; sourceTree = ""; @@ -385,6 +391,7 @@ EB72045F1680DDAD00278DA2 /* UIWindow-KIFAdditions.h in Headers */, EB7204601680DDAD00278DA2 /* NSFileManager-KIFAdditions.h in Headers */, EB7204611680DDAD00278DA2 /* LoadableCategory.h in Headers */, + EBAFFF3817C7C824003E3A1C /* SenTestCase-KIFAdditions.h in Headers */, EB7204621680DDAD00278DA2 /* KIFTypist.h in Headers */, EB7204631680DDAD00278DA2 /* KIFTestActor.h in Headers */, EB7204641680DDAD00278DA2 /* KIFTestCase.h in Headers */, @@ -588,6 +595,7 @@ EB72044D1680DDAD00278DA2 /* KIFTestCase.m in Sources */, EB72044E1680DDAD00278DA2 /* KIFSystemTestActor.m in Sources */, EB72044F1680DDAD00278DA2 /* KIFUITestActor.m in Sources */, + EBAFFF3917C7C824003E3A1C /* SenTestCase-KIFAdditions.m in Sources */, EBAE487D17A45A8E0005EE19 /* NSBundle-KIFAdditions.m in Sources */, EBAE488217A460E50005EE19 /* NSError-KIFAdditions.m in Sources */, EBAE488817A4E5C30005EE19 /* KIFTestStepValidation.m in Sources */,