From a065e04d529da1d847b5062a12c46d916408bf32 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 21:46:22 -0500 Subject: update based on https://github.com/mdn/yari/issues/2028 --- .../b2g_os/automated_testing/mtbf_tests/index.html | 233 --------------------- 1 file changed, 233 deletions(-) delete mode 100644 files/fr/archive/b2g_os/automated_testing/mtbf_tests/index.html (limited to 'files/fr/archive/b2g_os/automated_testing/mtbf_tests/index.html') diff --git a/files/fr/archive/b2g_os/automated_testing/mtbf_tests/index.html b/files/fr/archive/b2g_os/automated_testing/mtbf_tests/index.html deleted file mode 100644 index 8f624687ac..0000000000 --- a/files/fr/archive/b2g_os/automated_testing/mtbf_tests/index.html +++ /dev/null @@ -1,233 +0,0 @@ ---- -title: MTBF tests -slug: Archive/B2G_OS/Automated_testing/MTBF_tests -translation_of: Archive/B2G_OS/Automated_testing/MTBF_tests ---- -
-

Les essais de MTBF sont une suite de tests de Firefox OS construits au-dessus du framework  Gaiatest (Tests IU Gaia) . Les tests effectués sur de vrais dispositifs de Firefox OS, et utilisent Marionette pour conduire l'interface utilisateur de l'appareil. Ces tests sont conçus pour mesurer la stabilité / fiabilité de l'application, et de remplacer les tests d'endurance Gaia maintenant abandonnées.

-
- -

Mean time between failures (MTBF) is the predicted elapsed time between inherent failures of a system during operation. MTBF can be calculated as the arithmetic mean (average) time between failures of a system. The MTBF is typically part of a model that assumes the failed system is immediately repaired (mean time to repair, or MTTR), as a part of a renewal process. This is in contrast to the mean time to failure (MTTF), which measures average time to failures with the modeling assumption that the failed system is not repaired (infinite repair time).

- -

Current Environment & Setup

- -

MTBF tests are run by automation; the test suite collects general test cases like send sms, email, set alarm, etc., and executes them to emulate typical user behavior.  Right now we have more than 10 Firefox OS phones concurrently running tests in our test lab.

- -

How often are the tests run?

- -

MTBF is purposed to test on versions or branches with 0 functional failures.  it runs when everything passes in our smoke tests; the testing code should be in the Aurora (next release) branch.

- -

Where can I see the results?

- -

MTBF is still being developed and you can mail us for an early report (try the dev-b2g or dev-gaia mailing lists).  You can set up the necessary environment to run the tests yourself and generate your own reports by following the below steps.

- -

Running the tests

- -

Let's go through the steps required to set up the Gaia-UI MTBF test environment and run the tests on your local machine and Firefox OS device.

- -

Prerequisites

- - - -

If you are on Ubuntu, you need to check that it is configured to support the USB connection to the Firefox OS device. To verify this, connect the device to your computer via USB, open a terminal and enter the adb logcat command to see if it connects. If not, you may need to set up a udev rule for the device.

- -
-

Note: At the point where you start running through the following steps, the Firefox OS device should not be connected to your computer. You will be told when to connect it in the steps below.

-
- -

Step 1: Clone the MTBF-Driver repository from Mozilla-TWQA

- -

The Gaia-UI MTBF Tests are located in the Mozilla Github Gaia repository. Assuming that you haven’t done so already, the first step is to clone that repo:

- -
git clone https://github.com/Mozilla-TWQA/MTBF-Driver.git
- -

You may want to go get a coffee and come back in five minutes. Furthermore, you can get all the branches and try to switch to the current MTBF branch (e.g. master or v1.4+.) In this case, master matches the current master branch Gaia, and v1.4+ matches the v1.4/v1.3 branch Gaia.

- -

Step 2: Run the GaiaTest setup

- -

The Gaia-UI MTBF tests are built upon the GaiaTest framework (which uses Marionette). The next step is to run the setup script to install GaiaTest and all of the required dependencies. You may wish to create a new virtual environment to use with the Gaia-UI MTBF Tests. If you don’t, you may need to use sudo while running the setup command. In your terminal, type:

- -
cd MTBF-Driver
-python setup.py develop
- -

Step 3: Get memory tools if you need them

- -

To access the memory tools, find them in the tools directory in the B2G repo. If you've not already got this, clone it from Github like so (this is also a large download):

- -
git clone https://github.com/mozilla-b2g/B2G.git
- -

You should copy the tools folder into the MTBF-Driver/mtbf_drivers directory.

- -

Step 4: Set test vars and acknowledge risks

- -

GaiaTest uses a special file to set certain variables that are required for test configuration, for example to tell the device which WiFi network it should use. Before running the Gaia-UI MTBF Tests, you must set up the test vars file. Make a copy of the gaia/tests/python/gaia-ui-tests/gaiatest/testvars_template.json file in its existing location (rename it to something memorable) and edit it:

- - - -

Running the Gaia-UI MTBF tests will result in data being erased from the Firefox OS device and microSD card. This is to ensure that the tests start cleanly each time. For example, running a contacts test on a device that already has 10,000 contacts will have very different memory value results compared to running the same test on a device with no existing contacts. In order to run the tests, you must acknowledge that you are aware of this data loss risk. You should also backup any data you don't want to lose.

- -

To acknowledge the risks, add the following entry to your testvars file as the first field in the list: "acknowledged_risks": true.

- -
-

Note: If the risks are not acknowledged in the testvars file, the tests will not run.

-
- -

Step 5: Connect to USB and ADB Forward the Device

- -

Attach the Firefox OS device to your computer via USB.

- -
-

Note: If you’re using an Ubuntu VM, after attaching the device ensure the VM sees the device and connects to it; in the VM select VM > Removable Devices > Your Device > Connect and wait for the device to connect to the VM.

-
- -

Now tell adb to forward the device port to GaiaTest using the following command:

- -
adb forward tcp:2828 tcp:2828
- -
-

Note: If you are using the Firefox OS Leo device, you must first tell ADB to be the root user, like so:

- -
adb root
-adb forward tcp:2828 tcp:2828
-
- -

Step 6: Run a Test

- -

Now you’re ready to actually try running a test. Use the following commands:

- -
cd {MTBF Driver Folder}
-MTBF_TIME=1d MTBF_CONF=conf/local.json mtbf --address=localhost:2828 --testvars=mytestvars.json
- -

We can parse the MTBF_TIME by d(ay), h(our), or m(inute).

- -

If you get a “connection refused” error it means the device USB connection didn’t work; just repeat the device connection and try again.

- -

The Firefox OS device b2g process should now restart, then the specified test will run with a single iteration. If you watch the Firefox OS device, you’ll see the device UI being manipulated by Marionette. After the test finishes, a memory checkpoint will be performed.

- -
-

Note: The Gaia-UI MTBF tests now grab the Firefox OS device’s b2g process RSS value for the memory use checkpoint (it used to be the V-SIZE value.)

-
- -

The test result will be displayed in the terminal window. Note that this result doesn’t include the b2g process memory value; this value is stored in a text file, created at the time of the checkpoint in the checkpoints directory. To see the resulting b2g process, open this file. This "suite_summary" file will contain the average b2g process memory use (RSS) value, averaged from all the test checkpoints (in our example there was only one checkpoint.)

- -

There are two other files present in the checkpoints folder (assuming the test run was the "add contact" test):

- - - -

Step 7: Using Variables and Config Files

- -

We use envrionment variable MTBF_TIME for running duration.  The other one is MTBF_CONF which refers to json file, specific runner options include test case repository and list.  A normal config file should look like 

- -
{
-  "memory_report": false,
-  "logcat": true,
-  "overall_status": true,
-  "b2g_status": true,
-  "get_event": true,
-  "rootdir": "tests/mtbf",
-  "workspace": "/tmp/workspace",
-  "manifest_prefix": "mtbf",
-  "archive": "output",
-  "runlist": "runlist/all.list",
-  "level": 4
-}
- - - -

Contributing to the project

- -

If you have any questions about the Firefox OS MTBF tests or are interested in contributing to this important automation development effort, feel free to contact us at wachen@mozilla.com

- -

How to migrate test cases from Gaia-ui-tests

- -

This section provides a guide to migrating tests between gaia-ui tests and MTBF.

- -

Step 1: Rename

- - - -

Step 2: Add

- - - -

Step 3: Principles

- - - -

Step 4: About apps

- -
    -
  1. apps > mtbf_apps if needed.
  2. -
  3. Import original apps.
  4. -
  5. Add __init__() and any functions you need.
  6. -
- -

Step 5: After you have finished

- -
    -
  1. Test each test case using Test full suite > Test full suite with shuffle
  2. -
  3. Check PEP8 errors
  4. -
  5. Use a pull request to add your test cases to the main repo! Do not push directly.
  6. -
-- cgit v1.2.3-54-g00ecf