Skip to content

Commit c0a0724

Browse files
committed
Added details on using KIF-next with other testing frameworks.
Resolves issue #241.
1 parent d8f0d80 commit c0a0724

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

KIF-next.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Pod::Spec.new do |s|
22
s.name = "KIF-next"
3-
s.version = "2.0.0pre4"
3+
s.version = "2.0.0pre5"
44
s.summary = "UI acceptance testing in an OCUnit harness."
5-
s.homepage = "https://github.com/bnickel/KIF/"
5+
s.homepage = "https://github.com/kif-framework/KIF/"
66
s.license = 'Apache 2.0'
77
s.authors = 'Brian Nickel', 'Jim Puls', 'Eric Firestone', 'Michael Thole'
8-
s.source = { :git => "https://github.com/bnickel/KIF.git", :tag => "KIF-next-2.0.0pre4" }
8+
s.source = { :git => "https://github.com/kif-framework/KIF.git", :tag => "KIF-next-2.0.0pre5" }
99
s.platform = :ios, '4.3'
1010
s.source_files = 'Classes', 'Additions'
1111
s.public_header_files = 'Classes/**/*.h', 'Additions/**/*-KIFAdditions.h'

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The testing target will add a header and implementation file, likely "Acceptance
4343
Once your test target set up, add the following to your Podspec file. Use your target's name as appropriate.
4444

4545
target 'Acceptance Tests' do
46-
pod 'KIF-next', '~> 2.0.0pre2'
46+
pod 'KIF-next', '~> 2.0.0pre5'
4747
end
4848

4949
After running `pod install` complete the tasks in [**Final Test Target Configurations**](#configure-the-testing-target) below for the final details on getting your tests to run.
@@ -177,6 +177,36 @@ Most of the tester actions in the test are already defined by the KIF framework,
177177

178178
Everything should now be configured. When you run the integration tests using the test button, ⌘U, or the Xcode 5 Test Navigator (⌘5).
179179

180+
Use with other testing frameworks
181+
---------------------------------
182+
183+
`KIFTestCase` is not necessary for running KIF tests. Tests can run directly in `SenTestCase` or any subclass. The basic requirement is that when you call `tester` or `system`, `self` must be an instance of `SenTestCase`.
184+
185+
For example, the following [Specta](https://github.com/specta/specta) test works without any changes to KIF or Specta:
186+
187+
#import <Specta.h>
188+
#import <KIF.h>
189+
190+
SpecBegin(App)
191+
192+
describe(@"Tab controller", ^{
193+
194+
it(@"should show second view when I tap on the second tab", ^{
195+
[tester tapViewWithAccessibilityLabel:@"Second" traits:UIAccessibilityTraitButton];
196+
[tester waitForViewWithAccessibilityLabel:@"Second View"];
197+
});
198+
199+
});
200+
201+
SpecEnd
202+
203+
If you want to use KIF with a test runner that does not subclass `SenTestCase`, your runner class just needs to implement the `KIFTestActorDelegate` protocol which contains two required methods.
204+
205+
- (void)failWithException:(NSException *)exception stopTest:(BOOL)stop;
206+
- (void)failWithExceptions:(NSArray *)exceptions stopTest:(BOOL)stop;
207+
208+
In the first case, the test runner should log the exception and halt the test execution if `stop` is `YES`. In the second, the runner should log all the exceptions and halt the test execution if `stop` is `YES`. The exceptions take advantage of OCUnit's extensions to `NSException` with the properties `lineNumber` and `filename` to be used in recording the error's origin.
209+
180210
Troubleshooting
181211
---------------
182212

0 commit comments

Comments
 (0)