Coder Social home page Coder Social logo

gaia-ui-tests's Introduction

Introduction

Gaiatest is a Python package based on Marionette, which is designed specifically for writing tests against Gaia.

Installation

Installation is simple:

easy_install gaiatest

If you anticipate modifying gaiatest, you can instead:

git clone git://github.com/mozilla/gaia-ui-tests.git
cd gaia-ui-tests
python setup.py develop

Running Tests

To run tests using gaia test, your command-line will vary a little bit depending on what device you're using. The general format is:

gaiatest [options] /path/to/test_foo.py

If you are running tests directly in the repository, you will instead want to run (assuming you are in the gaia-ui-tests directory):

python gaiatest/runtests.py /path/to/test_foo.py

Options:

--emulator arm --homedir /path/to/emulator:  use these options to 
    let Marionette launch an emulator for you in which to run a test
--address <host>:<port>  use this option to run a test on an emulator
    which you've manually launched yourself, a real device, or a b2g
    desktop build.  If you've used port forwarding as described below,
    you'd specify --address localhost:2828
--testvars= (see section below)

If you use the --address localhost:2828 option, you must additionally setup port forwarding from the device to your local machine. You can do this by running the command:

adb forward tcp:2828 tcp:2828

adb is the 'android debug bridge', and is available in emulator packages under out/host/linux_x86/bin. Alternatively, it may be downloaded as part of the Android SDK, at http://developer.android.com/sdk/index.html.

Testvars

We use the --testvars option to pass in local variables, particularly those that cannot be checked into the repository. For example in gaia-ui-tests these variables can be your private login credentials, phone number or details of your WiFi connection.

To use it, copy testvars_template.json to a different filename but add it into .gitignore so you don't check it into your repository.

When running your tests add the argument: --testvars=(filename).json

Variables:

this_phone_number (string) The phone number of the SIM card in your device. Prefix the number with '+' and your international dialing code.

remote_phone_number (string) A phone number that your device can call during the tests (try not to be a nuisance!). Prefix the number with '+' and your international dialing code.

wifi.ssid (string) This is the SSID/name of your WiFi connection. Currently this supports WPA/WEP/etc. You can add wifi networks by doing the following (remember to replace "KeyManagement" and "wep" with the value your network supports) :

"wifi": { "ssid": "MyNetwork", "keyManagement": "WEP", "wep": "MyPassword" }

WPA-PSK: "wifi": { "ssid": "MyNetwork", "keyManagement": "WPA-PSK", "psk": "MyPassword" }

WPA-EAP: "wifi": { "ssid": "MyNetwork", "keyManagement": "WPA-EAP", "password": "MyPassword", "identity": "MyIdentity" }

Writing Tests

Test writing for Marionette Python tests is described at https://developer.mozilla.org/en-US/docs/Marionette/Marionette_Python_Tests.

Additionally, gaiatest exposes some API's for managing Gaia's lockscreen and application manager. See https://github.com/mozilla-b2g/gaia/blob/master/tests/python/gaiatest/gaia_test.py.

At the moment we don't have a specific style guide. Please follow the prevailing style of the existing tests. Use them as a template for writing your tests. We follow PEP8 for formatting, although we're pretty lenient on the 80-character line length.

gaia-ui-tests's People

Contributors

aaronmt avatar askeing avatar bebef1987 avatar bobsilverberg avatar davehunt avatar johnshih avatar retornam avatar schalkneethling avatar stephendonner avatar yurenju avatar

Stargazers

 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.