iosobjective-cunit-testingxctestkif-framework

KIF Test Case Crash at UIView-KIFAdditions.m class iOS


I want to write UI automation testing for one of my projects. I have did the following steps to setup the environment,

1.Create a new project (KIFDemo) with “Include Unit Tests” and “Include UI Tests”. 2.Created a Login page with “Username, Password TextFields and Login button”. Added Accessibility Label values. 3.Added KIF through Cocoa Pod like this,

target 'KIFDemo' do

Uncomment this line if you're using Swift or would like to use dynamic frameworks

use_frameworks!

Pods for KIFDemo

target 'KIFDemoTests' do inherit! :search_paths

Pods for testing pod 'KIF', '~> 3.2.0' pod 'Specta', '~> 1.0.2' end

target 'KIFDemoUITests' do inherit! :search_paths

Pods for testing

end

end

4.Created one UITests.m (SubClass of KIFTestCase) under “KIFDemoTests” folder. I have added this “beforeAll” function and code,

  • (void) beforeAll {

[tester enterText:@"user@example.com" intoViewWithAccessibilityLabel:@"UsernameTF"]; [tester enterText:@"thisismypassword" intoViewWithAccessibilityLabel:@"PasswordTF"];

[tester tapViewWithAccessibilityLabel:@"LoginButton"]; }

When I try to test this, am getting crash on following line,

// Handle touches in the normal way for other views UITouch *touch = [[UITouch alloc] initAtPoint:point inView:self]; [touch setPhaseAndUpdateTimestamp:UITouchPhaseBegan];

UIEvent *event = [self eventWithTouch:touch];

[[UIApplication sharedApplication] sendEvent:event];// Getting Thread 1: EXC_BAD_ACCESS

Can anyone please help me to fix this and test the app? I don't know what is breaking this one. Looking forward help. Thanks in advance.

Thanks, Yuvaraj M


Solution

  • it is the bug in KIF-framework, you can see this in various discussion on here1,here2 and finally here