Skip to main content

Avocado Test Framework

Project description

Avocado is a set of tools and libraries to help with automated testing.

One can call it a test framework with benefits. Native tests are written in Python and they follow the unittest (https://docs.python.org/3.6/library/unittest.html) pattern, but any executable can serve as a test.

Avocado is composed of:

Avocado is built on the experience accumulated with Autotest (http://autotest.github.io), while improving on its weaknesses and shortcomings.

Installing Avocado

Avocado is primarily written in Python, so a standard Python installation is possible and often preferable.

Installing with standard Python tools

The simplest installation method is through pip. On most POSIX systems with Python 3.4 (or later) and pip available, installation can be performed with a single command:

pip install --user avocado-framework

This will fetch the Avocado package (and possibly some of its dependecies) from the PyPI repository, and will attempt to install it in the user’s home directory (usually under ~/.local).

Tip: If you want to perform a system-wide installation, drop the --user switch.

If you want even more isolation, Avocado can also be installed in a Python virtual environment. with no additional steps besides creating and activating the “venv” itself:

python -m venv /path/to/new/virtual_environment
. /path/to/new/virtual_environment/bin/activate
pip install avocado-framework

Please note that this installs the Avocado core functionality. Many Avocado features are distributed as non-core plugins, also available as additional packages on PyPI. You should be able to find them via pip search avocado-framework-plugin | grep avocado-framework-plugin. Some of them are listed below:

  • avocado-framework-plugin-glib: Execution of GLib Test Framework tests

  • avocado-framework-plugin-golang: Execution of Golang tests

  • avocado-framework-plugin-loader-yaml: Loads tests from YAML files

  • avocado-framework-plugin-result-html: HTML Report for Jobs

  • avocado-framework-plugin-result-upload: Propagate Job results to remote host

  • avocado-framework-plugin-resultsdb: Propagate Job results to Resultsdb

  • avocado-framework-plugin-robot: Execution of Robot Framework tests

  • avocado-framework-plugin-runner-docker: Runner for Execution on Docker Containers

  • avocado-framework-plugin-runner-remote: Runner for Remote Execution

  • avocado-framework-plugin-runner-vm: Runner for libvirt VM Execution

  • avocado-framework-plugin-varianter-cit: Varianter with combinatorial capabilities

  • avocado-framework-plugin-varianter-pict: Varianter with combinatorial capabilities by PICT

  • avocado-framework-plugin-varianter-yaml-to-mux: Parse YAML file into variants

Installing from Packages

Fedora

Avocado is available in stock Fedora 24 and later. The main package name is python-avocado, and can be installed with:

dnf install python-avocado

Other available packages (depending on the Avocado version) may include:

  • python-avocado-examples: Avocado Test Framework Example Tests

  • python2-avocado-plugins-output-html: Avocado HTML report plugin

  • python2-avocado-plugins-runner-remote: Avocado Runner for Remote Execution

  • python2-avocado-plugins-runner-vm: Avocado Runner for libvirt VM Execution

  • python2-avocado-plugins-resultsdb: Avocado plugin to propagate job results to ResultsDB

  • python2-avocado-plugins-runner-docker: Avocado Runner for Execution on Docker Containers

  • python2-avocado-plugins-varianter-yaml-to-mux: Avocado plugin to generate variants out of yaml files

Fedora from Avocado’s own Repo

The Avocado project also makes the latest release, and the LTS (Long Term Stability) releases available from its own package repository. To use it, first get the package repositories configuration file by running the following command:

sudo curl https://avocado-project.org/data/repos/avocado-fedora.repo -o /etc/yum.repos.d/avocado.repo

Now check if you have the avocado and avocado-lts repositories configured by running:

sudo dnf repolist avocado avocado-lts
...
repo id      repo name                          status
avocado      Avocado                            50
avocado-lts  Avocado LTS (Long Term Stability)  disabled

Regular users of Avocado will want to use the standard avocado repository, which tracks the latest Avocado releases. For more information about the LTS releases, please refer to the Avocado Long Term Stability thread (https://www.redhat.com/archives/avocado-devel/2016-April/msg00038.html) and to your package management docs on how to switch to the avocado-lts repo.

Finally, after deciding between regular Avocado releases or LTS, you can install the RPM packages by running the following commands:

dnf install python-avocado

Additionally, other Avocado packages are available for Fedora:

  • python-avocado-examples: contains example tests and other example files

  • python2-avocado-plugins-output-html: HTML job report plugin

  • python2-avocado-plugins-resultsdb: propagate Job results to Resultsdb

  • python2-avocado-plugins-runner-remote: execution of jobs on a remote machine

  • python2-avocado-plugins-runner-vm: execution of jobs on a libvirt based VM

  • python2-avocado-plugins-runner-docker: execution of jobs on a Docker container

  • python-avocado-plugins-varianter-yaml-to-mux: parse YAML file into variants

  • python2-avocado-plugins-varianter-pict: varianter with combinatorial capabilities by PICT

Enterprise Linux

Avocado packages for Enterprise Linux are available from the Avocado project RPM repository. Additionally, some packages from the EPEL repo are necessary, so you need to enable it first. For EL7, running the following command should do it:

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Then you must use the Avocado project RHEL repo (https://avocado-project.org/data/repos/avocado-el.repo). Running the following command should give you the basic Avocado installation ready:

curl https://avocado-project.org/data/repos/avocado-el.repo -o /etc/yum.repos.d/avocado.repo
yum install python-avocado

Other available packages (depending on the Avocado version) may include:

  • python-avocado-bash: Avocado Test Framework Bash Utilities

  • python-avocado-common: Avocado common files

  • python-avocado-examples: Avocado Test Framework Example Tests

  • python2-avocado-plugins-glib: Avocado Plugin for Execution of GLib Test Framework tests

  • python2-avocado-plugins-golang: Avocado Plugin for Execution of golang tests

  • python2-avocado-plugins-loader-yaml: Avocado Plugin that loads tests from YAML files

  • python2-avocado-plugins-output-html: Avocado HTML report plugin

  • python2-avocado-plugins-result-upload: Avocado Plugin to propagate Job results to a remote host

  • python2-avocado-plugins-resultsdb: Avocado plugin to propagate job results to ResultsDB

  • python2-avocado-plugins-runner-docker: Avocado Runner for Execution on Docker Containers

  • python2-avocado-plugins-runner-remote: Avocado Runner for Remote Execution

  • python2-avocado-plugins-runner-vm: Avocado Runner for libvirt VM Execution

  • python2-avocado-plugins-varianter-cit: Varianter with Combinatorial Independent Testing capabilities

  • python2-avocado-plugins-varianter-pict: Varianter with combinatorial capabilities by PICT

  • python2-avocado-plugins-varianter-yaml-to-mux: Avocado plugin to generate variants out of yaml files

The LTS (Long Term Stability) repositories are also available for Enterprise Linux. For more information about the LTS releases, please refer to http://avocado-framework.readthedocs.io/en/latest/rfcs/LongTermStability.html and to your package management docs on how to switch to the avocado-lts repo.

Latest Development RPM Packages from COPR

Avocado provides a repository of continuously built packages from the GitHub repository’s master branch. These packages are currently available for EL7, Fedora 28 and Fedora 29, for both x86_64 and ppc64le.

If you’re interested in using the very latest development version of Avocado from RPM packages, you can do so by running:

dnf copr enable @avocado/avocado-latest
dnf install python*-avocado*

The following image shows the status of the Avocado packages building on COPR:

https://copr.fedorainfracloud.org/coprs/g/avocado/avocado-latest/package/python-avocado/status_image/last_build.png

OpenSUSE

The OpenSUSE project packages LTS versions of Avocado (https://build.opensuse.org/package/show/Virtualization:Tests/avocado). You can install packages by running the following commands:

zypper install avocado

Debian

DEB package support is available in the source tree (look at the contrib/packages/debian directory. No actual packages are provided by the Avocado project or the Debian repos.

Setting up a Development Environment

If you want to develop Avocado, or just run it directly from the GIT repository, fetch the source code and run:

make develop

From this point on, running avocado should load everything from your current source code checkout.

Brief Usage Instructions

To list available tests, call the list subcommand. For example:

avocado list

INSTRUMENTED <examples_path>/tests/abort.py:AbortTest.test
INSTRUMENTED <examples_path>/tests/canceltest.py:CancelTest.test
...
SIMPLE       <examples_path>/tests/passtest.sh

To run a test, call the run command:

avocado run <examples_path>/tests/passtest.sh
JOB ID     : <id>
JOB LOG    : <job-results>/job-<date>-<shortid>/job.log
(1/1) <examples_path>/tests/passtest.sh: PASS (0.04 s)
RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB TIME   : 0.14 s

To continue exploring Avocado, check out the output of avocado --help. When running Avocado out of package-based installs, its man page should also be accessible via man avocado.

Documentation

Avocado’s latest documentation build can be found at https://avocado-framework.readthedocs.io/.

Build and Quality Status

Copr build Basic checks on Cirrus CI lgtm total alerts lgtm language grade for Python lgtm language grade for JavaScript https://codecov.io/gh/avocado-framework/avocado/branch/master/graph/badge.svg Documentation Status

Project details


Release history Release notifications | RSS feed

This version

73.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

avocado-framework-73.0.tar.gz (646.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

avocado_framework-73.0-py3-none-any.whl (328.4 kB view details)

Uploaded Python 3

File details

Details for the file avocado-framework-73.0.tar.gz.

File metadata

  • Download URL: avocado-framework-73.0.tar.gz
  • Upload date:
  • Size: 646.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.5

File hashes

Hashes for avocado-framework-73.0.tar.gz
Algorithm Hash digest
SHA256 117f7918cc05f9832c2e742a7751454aea7de7414202eb48fe0beae2b47f6c52
MD5 e40155f5dd530bc0479e7ef845597dec
BLAKE2b-256 dfffcf6fd09a5139251de46107185f4200d89ca7488418d2b310d65092120e3b

See more details on using hashes here.

File details

Details for the file avocado_framework-73.0-py3-none-any.whl.

File metadata

  • Download URL: avocado_framework-73.0-py3-none-any.whl
  • Upload date:
  • Size: 328.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.5

File hashes

Hashes for avocado_framework-73.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f82f670aceca97e10d4a6d3020b9962681b4642cf7437f2a461b2cb0de6cbc78
MD5 e753826914a93e5019027301aeb5ed1a
BLAKE2b-256 f6d8c8ffd9489c1143d628f479f1fc2cba9534577592decd5ea16510c86027d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page