Code Monkey home page Code Monkey logo

appium's Introduction

Appium

Build Status

Appium is an open source, cross-platform test automation tool for native and hybrid mobile apps. It supports iOS, Android, and FirefoxOS platforms. Appium drives Apple's UIAutomation library and Android's UiAutomator framework (for newer platforms) using Selenium's WebDriver JSON wire protocol. Appium's iOS support is based on Dan Cuellar's work on iOS Auto. Appium also comes bundled with Selendroid for testing older Android platforms.

Testing with Appium has two big benefits:

  1. You don't have to recompile your app or modify it in any way, due to use of standard automation APIs on all platforms.

  2. You can write tests with your favorite dev tools using Java, Objective-C, JavaScript, PHP, Python, Ruby, C#, Clojure, or Perl with the Selenium WebDriver API and language-specific client libraries. You can use any testing framework. If you use Apple's UIAutomation library without Appium you can only write tests using JavaScript and you can only run tests through the Instruments application. Similarly, with Google's UiAutomator you can only write tests in Java. Appium opens up the possibility of true cross-platform native mobile automation. Finally!

Requirements

General:

  • Mac OS X 10.7 or higher, 10.8 recommended (Linux OK for Android-only; support for Windows is in "beta")
  • Node and npm (brew install node) (Node must be >= v0.8)

For iOS automation:

  • XCode
  • Apple Developer Tools (iPhone simulator SDK, command line tools)

For Android automation:

  • Android SDK API >= 17

User Quick Start

Option 1: Use Appium.app:

  • Download the Appium.app dmg
  • Run Appium.app then run a test using your favorite language / framework

Option 2: Run Appium from the command line using Node:

mkdir appium-test && cd appium-test
npm install -g appium  # might have to do this with sudo
npm install wd
curl -O https://raw.github.com/appium/appium/master/sample-code/examples/node/simplest.js
appium &
node simplest.js

See the next section for links on how to make sure your system is set up to run Appium tests.

Example Tests: Node.js | Python | PHP | Ruby | Java

Troubleshooting

We put together a troubleshooting guide. Please have a look here first if you run into any problems. It contains instructions for checking a lot of common errors and how to get in touch with the community if you're stumped.

Write Tests for Your Apps with Appium

We support a sub-set of the Selenium WebDriver JSON Wire Protocol.

You find elements by using a sub-set of WebDriver's element-finding strategies. See finding elements for detailed information.

We also have several extensions to the JSON Wire Protocol for automating mobile gestures like tap, flick, and swipe.

You can also automate web views in hybrid apps! See the hybrid app guide

We support Android and iOS platforms side-by-side:

For the full list of Appium doc pages, visit this directory.


Hacking with Appium

Install node.js (includes npm, the node.js package manager). The recommended way to install node is brew install node. Node installed by brew will not require sudo for npm commands.

Fork the Appium repo ( https://github.com/appium/appium ), then clone your fork.

From your local repo's command prompt, install these packages using the following commands (if you didn't install node using homebrew, you might have to run npm with sudo privileges):

npm install -g mocha
npm install -g grunt-cli
./reset.sh --dev

The first two commands install test and build tools (sudo may not be necessary if you installed node.js via Homebrew). The third command installs all app dependencies, builds supporting binaries and test apps. reset.sh is also the recommended command to run after pulling changes from master.

Hacking with Appium (iOS)

(First, have a look at setting up your system for Appium iOS support.)

To avoid a security dialog that may appear when launching your iOS apps you'll have to modify your /etc/authorization file in one of two ways:

  1. Manually modify the element following <allow-root> under <key>system.privilege.taskport</key> in your /etc/authorization file to <true/>.

  2. Run the following grunt command which automatically modifies your /etc/authorization file for you:

    sudo grunt authorize
    

At this point, you can simply run:

./reset.sh --ios --dev

Hacking with Appium (Android)

(First, have a look at setting up your system for Appium Android support (linux, osx or windows).)

Now, you can simply run:

./reset.sh --android --dev

If you want to use Selendroid for older apps:

./reset.sh --selendroid --dev

Make sure you have one and only one Android emulator or device running, e.g. by running this command in another process (assuming the emulator command is on your path):

emulator -avd <MyAvdName>

Making sure you're up to date

Since we use dev versions of some packages, it often becomes necessary to install new NPM packages or update various things. There's a handy shell script to do all this for all platforms (the --dev flag gets dev npm dependencies and test applications used in the Appium test suite):

./reset.sh --dev

Or you can run reset for individual platforms only:

./reset.sh --ios --dev
./reset.sh --android --dev
./reset.sh --selendroid --dev

Running Tests

Once, your system is set up and your code is up to date, you can run various kinds of tests:

grunt android
grunt ios
grunt selendroid
grunt firefoxos
grunt unit

Or you can run all tests:

grunt test

Before committing code, please run grunt to execute some basic tests and check your changes against code quality standards:

grunt
> Running "lint:all" (lint) task
> Lint free.
> Done, without errors.

Dig in deeper to Appium dev

Advanced grunt

If you want to run the Appium server and have it listen indefinitely, you can execute one of the following commands to start an Appium server with or without a specified app:

grunt appium           // launch Appium server without app
grunt appium:TestApp   // launch Appium server with the TestApp
grunt appium:UICatalog // launch Appium server with the UICatalog app

Like the power of automating dev tasks? Check out the Appium grunt tasks available to help with building apps, installing apps, generating docs, etc...

Running individual tests

If you have an Appium server listening, you can run individual test files using Mocha, for example:

mocha -t 60000 -R spec test/functional/testapp/simple.js

Advanced Appium server flags

Do you like getting close to the metal? Or are you trying to launch an Appium server from a script with a custom app? If so you can start Appium without grunt from the command line with an app or without an app, among other things:

node server.js // launch Appium server without app
node server.js --app /absolute/path/to/app  // launch Appium server with app
node server.js --launch // pre-launch the app when appium loads
node server.js --log /my/appium.log // log to file instead of stdout
node server.js --quiet // don't log verbose output

(See the server documentation for all CLI arguments.)

Using with a Bitbeambot and other robots

Check out the Appium Robots project

Contributing

Fork the project, make a change, and send a pull request!

Oh and please have a look at our Style Guide before getting to work.

Project Credits & Inspiration

The open source community has made this project possible, please add missing projects to the list.

All the OSS code contributing to Appium

Mailing List

Announcements and debates often take place on the Discussion Group, be sure to sign up!

appium's People

Contributors

admc avatar bernii avatar bootstraponline avatar brainsik avatar dawogfather avatar dylanlacey avatar gaige avatar hugs avatar jlipps avatar jmathes avatar lukeis avatar maudineormsby avatar onioni avatar penguinho avatar rorosha avatar rossrowe avatar rubarb avatar sah avatar santiycr avatar satchit avatar snevesbarros avatar sourishkrout avatar swapna-chennadi avatar xuru avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.