Appium is an open source test automation framework that can be used to write automated test scripts for native, hybrid and mobile web apps on iOS and Android platforms. It drives iOS and Android apps using the WebDriver protocol. Appium allows testing on emulators and real devices by interacting with APIs provided by each mobile platform. Test scripts are written in Java, Python, JavaScript or other languages that support the WebDriver protocol.
4. Appium is an open source test
automation framework for use
with native, hybrid and mobile
web apps.
It drives iOS and Android apps
using the WebDriver protocol.
from: http://appium.io/
11. node_modules/appium/bin/appium.js
var appium = require('../lib/server/main.js');
!
var startRepl = function () {
var help = function () {
console.log("nWelcome to the Appium CLI".cyan);
console.log(" - Access the appium object via the object: 'appium'".grey);
console.log(" - appium.run is the function to start the server".grey);
console.log(" - args is the default params data structure".grey);
console.log(" - set args.app then run appium.run(args);n".grey);
return 'Thanks for asking';
};
!
help();
!
var r = repl.start('(appium): ');
r.context.appium = appium;
r.context.parser = parser();
r.context.help = help;
r.context.args = {
app: '/path/to/test/app'
, udid: null
, address: '127.0.0.1'
, port: 4723
};
!
var connections = 0;
var server = net.createServer(function (socket) {
connections += 1;
socket.setTimeout(5 * 60 * 1000, function () {
socket.destroy();
});
repl.start("(appium): ", socket);
}).listen(process.platform === "win32" ? ".pipenode-repl-sock-" + process.pid : "/tmp/node-repl-sock-" +
process.pid);
!
r.on('exit', function () {
server.close();
process.exit();
});
17. create new plist before start app
appium/lib/devices/ios/ios.js
IOS.prototype.setDeviceTypeInInfoPlist = function (cb) {
var plist = path.resolve(this.args.app, "Info.plist");
var dString = this.getDeviceString();
var isiPhone = dString.toLowerCase().indexOf("ipad") === -1;
var deviceTypeCode = isiPhone ? 1 : 2;
parsePlistFile(plist, function (err, obj) {
if (err) {
logger.error("Could not set the device type in Info.plist");
return cb(err, null);
} else {
var newPlist;
obj.UIDeviceFamily = [deviceTypeCode];
if (binaryPlist) {
newPlist = bplistCreate(obj);
} else {
newPlist = xmlplist.build(obj);
}
fs.writeFile(plist, newPlist, function (err) {
if (err) {
logger.error("Could not save new Info.plist");
cb(err);
} else {
logger.debug("Wrote new app Info.plist with device type");
cb();
}
}.bind(this));
}
}.bind(this));
};