Gaia-ui-tests uses Gaiatest, a Python package based around Marionette. Gaiatest is designed to wrap HTML locators, Marionette calls and API calls together for interoperble communication and functionality. Marionette is based on the W3C standard developed for the Selenium WebDriver a programming interface for browser automation. If you have used WebDriver and page/app objects before then you will find using Marionette and gaiatest easy.
Getting started with Gaia UI tests
For those keen to get started with automated testing on Gaia/Firefox OS we have a tutorial series that will help you go from nothing to writing your own tests. Once you've completed this tutorial you'll have enough knowledge of testing, Firefox OS and Marionette to get started as a Mozilla tests contributor. It is highly recommended that you complete this tutorial if you wish to become a contributor.
- Part 1: Getting started with Marionette and Firefox OS
- This article covers installing the tools you need to get started with running tests, such as B2G Desktop, Python and Marionette.
- Part 2: Basic interactions with Firefox OS using Marionette
- An overview of the basic commands you will use to manipulate Firefox OS via Marionette.
- Part 3: Upgrading our code into a reusable test
- Moving on, in this article we will assemble some basic commands into a simple test inside a Python file so they can all be run as a single entity.
- Part 4: Re-using commands to set up Firefox OS
- Here we look at moving some of the commands into Python methods to promote code reuse.
- Part 5: Introducing a test runner
- A test runner is a central feature of any good test suite, allowing you to run multiple tests and report and aggregate results. In this article we will explore the basics of Python's unittest runner.
- Part 6: Using tuples, and Marionette's By class
This time around we explain how to further reduce duplication of code, by storing repeated locators in tuples and simplifying the syntax with Marionette's
- Part 7: Writing your own tests
- Now the basics and behind you, and it is time to start to writing your own tests! Here we give you some tool recommendations to make the work easier, and suggest some tests to try your hand at writing.
- Part 8: Using a base class
- In its current state, our test file contains all the test runner code. This is ok for now, but as soon as you start to run many test files it will mean a lot of duplication. Here we solve this problem by abstracting the test runner code into a separate Python class.
- Part 9: Reducing duplication with app objects
- As a final improvement to the code's maintainability, in this article we explore abstracting code that handles interaction with specific Firefox OS apps out into Python app objects.
One you've got the basics of writing and running tests under your belt, you way want to move on to some more involved or advanced work, such as running the full gaia-ui-tests tests suite, or logging power draw as the result of a test.
- Running the gaia-ui-tests
- Guides to running the gaia-ui-tests suite against real Firefox OS devices and B2G Desktop in a variety of configurations.
- Gathering Power Draw
- How to use gaiatest to log power draw while a test is running.
This project is at a fairly early stage, and your feedback would be greatly appreciated: