UIAutomation_Testing
-
Upload
krunal-soni -
Category
Documents
-
view
102 -
download
1
Transcript of UIAutomation_Testing
Testing Automation
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
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.
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.
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.
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.
Preparing Your
Application
8
Add accessibility info to the UI: 1. Interface Builder:
2. Programmatically:
Eg. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ..
..
..
cell.isAccessibilityElement = YES;
cell.accessibilityLabel = @"user name“
..
..
}
Writing UI Automation
Scripts
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.
RunningYour
Scripts
When you launch Instruments, choose "Automation" from the iPhone templates.
UI Automation Dashboard :
Click here
Text Editor to write the scripts
Press “Record” to start the automation process
DebuggingYourTests
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
THANK YOU