Chris Dent 08cb8ac1bd Allowing forcing SSL in build_tests and gabbi-run
build_tests gains a require_ssl argument which, if set to True,
makes all the loaded test suites default to 'ssl: True'.

gabbi-run will interpret a target containing 'https' as meaning
that the tests in the provided yaml should default to 'ssl: True'.

Fixes: #50
Fixes: #105
Fixes: #138

The changes here are the naive basics to get the desired behavior.
There's an existing cleanup branch on which we can clean this up
later.
2016-06-02 09:15:57 +01:00

1.4 KiB

YAML Runner

If there is a running web service that needs to be tested and creating a test loader with ~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, generates and runs tests and outputs a summary of the results.

The provided YAML may not use custom fixtures but otherwise uses the default format. 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 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.

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