Revision 393309 of Gaia UI Tests - Environment Setup: Installing gaiatest

  • Revision slug: Mozilla/Firefox_OS/Platform/Testing/gaia-ui-tests/Gaia_UI_Tests_Installation
  • Revision title: Gaia UI Tests Environment Setup
  • Revision id: 393309
  • Created:
  • Creator: ypwalter
  • Is current revision? No
  • Comment

Revision Content

This page assumes you are familiar with Firefox OS

 

This page hasn't finished yet.
Your feedback to gaia-ui-automation@mozilla.org would be greatly appreciated.

Environment Setup

Basic Information

    Gaia UI tests will utilize marionette client to communicate with marionette server on device/emulator. We will elaborate about the different ways to install different components for gaia-ui-tests later. There are two different ways to install gaia-ui-tests depending on your needs.

Route 1 - for test executor
    If you only want to run the tests without developing anything, just the command below in command line. It should

easy_install gaiatest

Route 2 - for developers (suggested option)
    If you participate in modifying gaiatest, you can do this instead:

git clone git://github.com/mozilla/gaia-ui-tests.git

    If you do not want to install gaiatest and dependencies into system's site-packages, follow the steps in Virtual Environment Setup section below. Or, you can just setup gaiatest by the following command:

cd gaia-ui-tests
python setup.py develop

    Please do notice that there are different branches in gaia-ui-tests. Choose the branch best describe your current B2G status. For an example, if you wish to do the test on B2G desktop version, you might want to switch branch to desktop branch.

    If you have no further plan on modifying marionette client or marionette server code, you can skip the rest of this section and virtual environment setup section to "Running Tests" section.

    To take control over marionette client or marionette server, you will need to install most-up-to date marionette client  or to match marionette client version since gaia-ui-tests is using marionette client to communicate with marionette server inside device/emulator.

    You can either download marionette from marionette client official distribution website or marionette client would come with your B2G code from github after configuration. After that, marionette client is at $B2G_HOME/gecko/testing/marionette/client. You can find marionette server at $B2G_HOME/gecko/testing/marionette/. Please notice that you must config you B2G as an engineer build, or you will fail to find these codes.

Virtual Environment Setup

    The virtualenv allows you to install gaiatest and all package dependencies into the virtual environment without affecting system site-packages. You could find the tutorial on virtualenv official website, or you can reference the tutorial down below:

    First of all, get the virtualenv installed by easy_install:

easy_install virtualenv

    Or using Ubuntu's apt tool to install virtualenv:

apt-get install python-virtualenv

Creating and Activating

    Then create your virtual environment for Python and activate it:

virtualenv <ENV_NAME>
source <ENV_NAME>/bin/activate
    After activating the virtual environment, the prompt will looks like this:
(<ENV_NAME>)user@host:~$  

    You can creating more than one virtual environment for your purpose.

Setup the gaiatest

    Usually, you just only need to follow the steps to install dependencies for gaiatest into virtual environment.

cd gaia-ui-tests
python setup.py develop

Deactivating

    When you want to leave current virtual environment, input the command to deactivate it:

deactivate

 

Go to "Running Tests" section

Revision Source

<div class="warning">
  <p><strong><em>This page assumes you are familiar with Firefox OS</em></strong></p>
  <p>&nbsp;</p>
  <p><em><strong>This page hasn't finished yet.<br />
    Your feedback to gaia-ui-automation@mozilla.org would be greatly appreciated.</strong></em></p>
</div>
<h2 id="Environment_Setup">Environment Setup</h2>
<h3 id="Basic_Information">Basic Information</h3>
<p>&nbsp;&nbsp;&nbsp; Gaia UI tests will utilize marionette client to communicate with marionette server on device/emulator. We will elaborate about the different ways to install different components for gaia-ui-tests later. There are two different ways to install gaia-ui-tests depending on your needs.</p>
<p><strong>Route 1 - for test executor</strong><br />
  &nbsp;&nbsp;&nbsp; If you only want to run the tests without developing anything, just the command below in command line. It should</p>
<pre>
<code>easy_install gaiatest
</code></pre>
<p><strong>Route 2 - for developers (suggested option)</strong><br />
  &nbsp;&nbsp;&nbsp; If you participate in modifying gaiatest, you can do this instead:</p>
<pre>
<code>git clone git://github.com/mozilla/gaia-ui-tests.git
</code></pre>
<p>&nbsp;&nbsp;&nbsp; If you do not want to install gaiatest and dependencies into system's site-packages, follow the steps in <a href="#Virtual_Environment_Setup" title="#Virtual_Environment_Setup"><strong>Virtual Environment Setup</strong></a> section below. Or, you can just setup gaiatest by the following command:</p>
<pre style="font-size: 14px;">
<code style="font-size: 14px;">cd gaia-ui-tests
python setup.py develop</code></pre>
<p>&nbsp;&nbsp;&nbsp; Please do notice that there are different branches in gaia-ui-tests. Choose the branch best describe your current B2G status. For an example, if you wish to do the test on B2G desktop version, you might want to switch branch to desktop branch.</p>
<div class="note">
  <p><strong>&nbsp;&nbsp;&nbsp; If you have no further plan on modifying marionette client or marionette server code, you can skip the rest of this section and virtual environment setup section to <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Platform/Testing/gaia-ui-tests/Gaia_UI_Tests_Run_Tests" title="https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Platform/Testing/gaia-ui-tests/Gaia_UI_Tests_Run_Tests">"Running Tests" section</a>.</strong></p>
</div>
<p>&nbsp;&nbsp;&nbsp; To take control over marionette client or marionette server, you will need to install most-up-to date <a href="https://pypi.python.org/pypi/marionette_client/" title="https://pypi.python.org/pypi/marionette_client/">marionette client</a>&nbsp; or to match marionette client version since gaia-ui-tests is using marionette client to communicate with marionette server inside device/emulator.<br />
  <br />
  &nbsp;&nbsp;&nbsp; You can either download marionette from <a href="https://pypi.python.org/pypi/marionette_client/" title="https://pypi.python.org/pypi/marionette_client/">marionette client official distribution website</a> or marionette client would come with your<a href="https://github.com/mozilla-b2g/B2G" title="https://github.com/mozilla-b2g/B2G"> B2G code from github</a> after configuration. After that, marionette client is at $B2G_HOME/gecko/testing/marionette/client. You can find marionette server at $B2G_HOME/gecko/testing/marionette/. Please notice that you must config you B2G as an engineer build, or you will fail to find these codes.</p>
<h3 id="Virtual_Environment_Setup">Virtual Environment Setup</h3>
<p>&nbsp;&nbsp;&nbsp; The <em>virtualenv</em> allows you to install gaiatest and all package dependencies into the virtual environment without affecting system site-packages.&nbsp;You could find the tutorial on <a href="https://pypi.python.org/pypi/virtualenv" title="https://pypi.python.org/pypi/virtualenv">virtualenv official website</a>, or you can reference the tutorial down below:</p>
<p>&nbsp;&nbsp;&nbsp; First of all, get the virtualenv installed by easy_install:</p>
<pre style="font-size: 14px;">
easy_install virtualenv</pre>
<p>&nbsp; &nbsp; Or using Ubuntu's apt tool to install virtualenv:</p>
<pre style="font-size: 14px;">
apt-get install python-virtualenv</pre>
<p><strong>Creating and Activating</strong></p>
<p>&nbsp; &nbsp; Then create your virtual environment for Python&nbsp;and activate it:</p>
<pre style="font-size: 14px;">
virtualenv &lt;ENV_NAME&gt;
source &lt;ENV_NAME&gt;/bin/activate</pre>
<div>
  &nbsp; &nbsp; After activating the virtual environment, the prompt will looks like this:</div>
<div>
  <pre style="font-size: 14px;">
(&lt;ENV_NAME&gt;)user@host:~$ &nbsp;</pre>
  <p>&nbsp; &nbsp; You can creating more than one virtual environment for your&nbsp;purpose.<br />
    <br />
    <strong>Setup the gaiatest</strong></p>
  <p><span style="line-height: 1.572;">&nbsp; &nbsp; Usually, you just only need to follow the steps to install&nbsp;</span><span style="line-height: 1.572;">dependencies for gaiatest into virtual environment.</span></p>
  <pre style="font-size: 14px;">
cd gaia-ui-tests
python setup.py develop</pre>
  <p><strong>Deactivating</strong></p>
  <p><span style="line-height: 1.572;">&nbsp; &nbsp; When you want to leave current virtual environment, input&nbsp;the command to deactivate it:</span></p>
  <div>
    <pre style="font-size: 14px;">
deactivate</pre>
  </div>
</div>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;"><strong>Go to <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Platform/Testing/gaia-ui-tests/Gaia_UI_Tests_Run_Tests" title="https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Platform/Testing/gaia-ui-tests/Gaia_UI_Tests_Run_Tests">"Running Tests"</a> section</strong></p>
Revert to this revision