File: runner.rst

package info (click to toggle)
python-gabbi 3.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 932 kB
  • sloc: python: 3,711; makefile: 60; sh: 32
file content (75 lines) | stat: -rw-r--r-- 2,666 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
YAML Runner
===========

If there is a running web service that needs to be tested and
creating a test loader with :meth:`~gabbi.driver.build_tests` is
either inconvenient or overkill it is possible to run YAML test
files directly from the command line with the console-script
``gabbi-run``. It accepts YAML on ``stdin`` or as multiple file
arguments, and generates and runs tests and outputs a summary of
the results.

The provided YAML may not use custom :doc:`fixtures` but otherwise
uses the default :doc:`format`. :doc:`host` information is either
expressed directly in the YAML file or provided on the command
line::

    gabbi-run [host[:port]] < /my/test.yaml

or::

    gabbi-run http://host:port < /my/test.yaml

To test with one or more files the following command syntax may be
used::

    gabbi-run http://host:port -- /my/test.yaml /my/other.yaml

.. note:: The filename arguments must come after a ``--`` and all
          other arguments (host, port, prefix, failfast) must come
          before the ``--``.

.. note:: If files are provided, test output will use names
          including the name of the file. If any single file includes
          an error, the name of the file will be included in a summary
          of failed files at the end of the test report.

To facilitate using the same tests against the same application mounted
in different locations in a WSGI server, a ``prefix`` may be provided
as a second argument::

    gabbi-run host[:port] [prefix] < /my/test.yaml

or in the target URL::

    gabbi-run http://host:port/prefix < /my/test.yaml

The value of prefix will be prepended to the path portion of URLs that
are not fully qualified.

Anywhere host is used, if it is a raw IPV6 address it should be
wrapped in ``[`` and ``]``.

If ``https`` is used in the target, then the tests in the provided
YAML will default to ``ssl: True``.

Use ``-k`` or ``--insecure`` to **not** validate certificates when making
``https`` connections.

If a ``-x`` or ``--failfast`` argument is provided then ``gabbi-run`` will
exit after the first test failure.

Use ``-v`` or ``--verbose`` with a value of ``all``, ``headers`` or ``body``
to turn on :ref:`verbosity <metadata>` for all tests being run.

Use ``-q`` or ``--quiet`` to silence test runner output.

Use ``-r`` or ``--response-handler`` to load a custom response or content
handler for use with tests.

Use ``-l`` to load response handlers relative to the current working directory.

For example, to load a handler named ``HTMLHandler`` from the ``handlers.html``
module relative to the current directory:

    gabbi-run -l -r handlers.html:HTMLHandler http://example.com < my.yaml