【avocado】avocado基本概念与使用

文章目录

      • 1.安装
      • 2.基本概念
      • 3.基本使用

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.
    【avocado】avocado基本概念与使用_第1张图片
  • 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
    【avocado】avocado基本概念与使用_第2张图片

  • Job Diff
    【avocado】avocado基本概念与使用_第3张图片

  • Listing tests
    【avocado】avocado基本概念与使用_第4张图片

  • Job show
    【avocado】avocado基本概念与使用_第5张图片

  • 日志查看

    On a machine that executed Avocado, job results are available under [job-results]/job-[timestamp]-[short job ID]
    【avocado】avocado基本概念与使用_第6张图片

  • 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:
    【avocado】avocado基本概念与使用_第7张图片

  • 配置文件
    【avocado】avocado基本概念与使用_第8张图片

你可能感兴趣的:(软件集成测试框架,python,集成测试)