UIAutomation_Testing

19
Testing Automation

Transcript of UIAutomation_Testing

Page 1: UIAutomation_Testing

Testing Automation

Page 2: UIAutomation_Testing

2

Testing Challenges

Coverage of range of devices and OS versions

Regression testing cycle is repetitive process due to which some flows get skipped

Quicker Time to Market

Page 3: UIAutomation_Testing

Why Automation ?????

Fast: Runs tests significantly faster than human users.

Repeatable: Testers can test how the application reacts after repeated execution of the same operation.

Reusable: Tests can be re-used on different versions of the software.

Reliable: Tests perform precisely the same operation each time they are run thereby eliminating human error.

Comprehensive: Testers can build test suites of tests that covers every feature in software software application

Programmable: Testers can program sophisticated tests that bring hidden information.

Page 4: UIAutomation_Testing

4

Possible options for Automation

• Frank : It is a combination of Cucumber and Json Commands sender to the server within native application.

Pros :

Css Style syntax. Command Line support.

Cons :

Driven by Cucumber based on ruby difficult to understand.

Difficult to run on devices.

Less Support for gestures.

Page 5: UIAutomation_Testing

5

Possible options for Automation

• KIF : It is an Objective – C based relatively new framework.

Pros :

Test are in Objective – C easier to pick.

Command line support. Reasonable support for gestures.

Cons :

Fair amount of changes in production code.

Tricky to integrate with back end stubs because it’s all running in-process.

Not stand alone.

Page 6: UIAutomation_Testing

Possible options for Automation

• UIAutomation : Apple's own solution for testing. It runs tests in Javascript using instruments.

Pros :

Most closely linked to the device.

Very good support for gestures.

Cons :

Not so good integration with the command line. Can't integrate with 3rd party testing tools.

Less Support for gestures.

Page 7: UIAutomation_Testing

Preparing Your

Application

Page 8: UIAutomation_Testing

8

Add accessibility info to the UI: 1. Interface Builder:

Page 9: UIAutomation_Testing

2. Programmatically:

Eg. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ..

..

..

cell.isAccessibilityElement = YES;

cell.accessibilityLabel = @"user name“

..

..

}

Page 10: UIAutomation_Testing

Writing UI Automation

Scripts

Page 11: UIAutomation_Testing

Writing the test in JavaScript in editor of your choice.

Few pre-requisites:

1) var target = UIATarget.localTarget() - a sort of proxy for the user of the application.

2) var application = target.frontMostApp() - access to the top- level structure of your application .

3) var window = app.mainWindow() - access to things like the parent view, child views, pickers, sliders, etc.

Page 12: UIAutomation_Testing
Page 13: UIAutomation_Testing
Page 14: UIAutomation_Testing

RunningYour

Scripts

Page 15: UIAutomation_Testing

When you launch Instruments, choose "Automation" from the iPhone templates.

Page 16: UIAutomation_Testing

UI Automation Dashboard :

Click here

Text Editor to write the scripts

Press “Record” to start the automation process

Page 17: UIAutomation_Testing

DebuggingYourTests

Page 18: UIAutomation_Testing

var target = UIATarget.localTarget();var app = target.frontMostApp();var window = app.mainWindow();......UIALogger.logStart(“test”);try{

// some code

if(true){UIALogger.logPass(“test”);

} else{UIALogger.logFail(“test);target.captureScreenWithName(“test-failed”);

}

}catch(e){

UIALogger.logError(e);UIALogger.logFail(“test”);

}

Provision for taking application screen shot

in case of test script failure or application crash

Page 19: UIAutomation_Testing

THANK YOU