1.安装
- core functionality
Installing from PyPI (推荐安装方式,其他安装方式请查看Install)
pip3 install --user avocado-framework (core functionality)
或
python3 -m pip install "avocado-framework<94"
- Plugins安装(other features)详细
python3 -m pip install "avocado-framework-plugin-result-html<94"
python3 -m pip install "avocado-framework-plugin-varianter-yaml-to-mux<94"
注:请安装自己需要的plugins
2.基本概念
- Job ID
The Job ID is a random SHA1 string that uniquely identifies a given job.
- Conventions约定
It’s common for a single file to contain multiple tests. In that case, information about the specific test to reference can be added after the filesystem location and a colon, that is, for the reference:
./examples/tests/sleeptest.py:SleepTest.test
- Variant IDs
The varianter component creates different sets of variables (known as “variants”), to allow tests to be run individually in each of them. - Test ID
Syntax: <unique-id>-<test-name>[;<variant-id>]
- Test types
Avocado at its simplest configuration can run three different types of tests:
Executable tests (exec-test)
python unittest
instrumented
You can mix and match those in a single job.
Avocado plugins can also introduce additional test types.
-
Instrumented
These are tests written in Python or BASH with the Avocado helpers that use the Avocado test API.
To be more precise, the Python file must contain a class derived from avocado.test.Test. This means that an executable written in Python is not always an instrumented test, but may work as an executable test.
The instrumented tests allows the writer finer control over the process including logging, test result status and other more sophisticated test APIs.
Test statuses PASS, WARN and SKIP are considered successful. The ERROR, FAIL and INTERRUPTED signal failures.
3.基本使用
-
Job Replay
To run a new job with the configuration used by the previously executed job, it’s possible to simply execute:
$ avocado replay latest/jobids
-
Job Diff
-
Listing tests
-
Job show
-
日志查看
On a machine that executed Avocado, job results are available under [job-results]/job-[timestamp]-[short job ID]
-
Filtering tests by tags
Avocado allows tests to be given tags, which can be used to create test categories. With tags set, users can select a subset of the tests found by the test resolver.
Usually, listing and executing tests with the Avocado test runner would reveal all three tests:
-
配置文件