GetStartedGuide.rst 2.9 KB
Newer Older
1 2
.. _get-started:

3
=============================
4 5 6
Getting started guide - users
=============================

7 8 9 10
If you want to simply use avocado as a test runner/test API, you can install a
distro package. For Fedora, you can look
at `lmr's autotest COPR`_, while for Ubuntu, you can look
at `lmr's autotest PPA`_.
11 12

.. _lmr's autotest COPR: http://copr.fedoraproject.org/coprs/lmr/Autotest
13
.. _lmr's autotest PPA: https://launchpad.net/~lmr/+archive/autotest
14

15 16
Avocado is primarily being developed on Fedora boxes, but we are making
reasonable efforts that Ubuntu users can use and develop avocado well.
17 18

Installing avocado - Fedora
19
---------------------------
20 21 22 23 24 25 26

You can install the rpm package by performing the following commands:

::

    sudo curl http://copr.fedoraproject.org/coprs/lmr/Autotest/repo/fedora-20-i386/ > /etc/yum.repos.d/autotest.repo
    sudo yum update
27 28
    sudo yum install avocado

29 30 31 32 33 34 35 36 37 38 39
Installing avocado - Ubuntu
---------------------------

You can install the debian package by performing the following commands:

::

    sudo add-apt-repository ppa:lmr/autotest
    sudo apt-get update
    sudo apt-get install avocado

40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94

Running the avocado test runner
-------------------------------

The test runner is designed to conveniently run tests on your laptop. The tests
you can run are:

* Tests written in python, using the avocado API, which we'll call `native`.
* Any executable in your box, really. The criteria for PASS/FAIL is the return
  code of the executable. If it returns 0, the test PASSed, if it returned
  != 0, it FAILed. We'll call those tests `dropin`.

Avocado looks for avocado "native" tests in some locations, the main one is in
the config file ``/etc/avocado/settings.ini``, section ``runner``, ``test_dir``
key. You can list tests by::

    $ avocado list
    Tests available:
        failtest
        sleeptest
        synctest

You can run them using the subcommand ``run``::

    $ scripts/avocado run sleeptest
    DEBUG LOG: /home/lmr/Code/avocado/logs/run-2014-04-23-19.06.39/debug.log
    TOTAL TESTS: 1
    (1/1) sleeptest.1:  PASS (1.09 s)
    TOTAL PASSED: 1
    TOTAL ERROR: 0
    TOTAL FAILED: 0
    TOTAL SKIPPED: 0
    TOTAL WARNED: 0
    ELAPSED TIME: 1.09 s

You can run any number of test in an arbitrary order, as well as mix and match
native tests and dropin tests::

    $ echo '#!/bin/bash' > /tmp/script_that_passes.sh
    $ echo 'true' >> /tmp/script_that_passes.sh
    $ scripts/avocado run "failtest sleeptest synctest failtest synctest /tmp/script_that_passes.sh"
    DEBUG LOG: /home/lmr/Code/avocado/logs/run-2014-04-23-19.16.46/debug.log
    TOTAL TESTS: 6
    (1/6) failtest.1:  FAIL (0.09 s)
    (2/6) sleeptest.1:  PASS (1.09 s)
    (3/6) synctest.1:  PASS (2.33 s)
    (4/6) failtest.2:  FAIL (0.10 s)
    (5/6) synctest.2:  PASS (1.94 s)
    (6/6) script_that_passes.1:  PASS (0.11 s)
    TOTAL PASSED: 4
    TOTAL ERROR: 0
    TOTAL FAILED: 2
    TOTAL SKIPPED: 0
    TOTAL WARNED: 0
    ELAPSED TIME: 5.67 s