简体   繁体   中英

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

这是KIF-framework的错误,您可以在here1here2和最后的此处的各种讨论中看​​到这一点

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM