diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-02-25 08:45:49 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-02-25 08:45:49 +0000 |
commit | 47e3ac11fddeed90819411a8291ad392b39a7402 (patch) | |
tree | 8837d4a632aa0a479f28be0d3b3aff01353c6bf0 /HACKING.rst | |
parent | 78da3db8ae9d9e5494915cc3141d5934ad0ff48f (diff) | |
parent | a5afb4fc3e7fb8d253eb1d8b08ef1884641f7759 (diff) | |
download | tempest-47e3ac11fddeed90819411a8291ad392b39a7402.tar.gz |
Merge "Adapt documentation for negative testing"
Diffstat (limited to 'HACKING.rst')
-rw-r--r-- | HACKING.rst | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/HACKING.rst b/HACKING.rst index e7e765153..c0df0fb90 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -108,16 +108,36 @@ they do not need to be tagged as compute. Negative Tests -------------- -When adding negative tests to tempest there are 2 requirements. First the tests -must be marked with a negative attribute. For example:: +Newly added negative tests should use the negative test framework. First step +is to create an interface description in a json file under `etc/schemas`. +These descriptions consists of two important sections for the test +(one of those is mandatory): - @attr(type=negative) - def test_resource_no_uuid(self): - ... + - A resource (part of the URL of the request): Resources needed for a test + must be created in `setUpClass` and registered with `set_resource` e.g.: + `cls.set_resource("server", server['id'])` + + - A json schema: defines properties for a request. + +After that a test class must be added to automatically generate test scenarios +out of the given interface description: + + class SampeTestNegativeTestJSON(<your base class>, test.NegativeAutoTest): + _interface = 'json' + _service = 'compute' + _schema_file = 'compute/servers/get_console_output.json' + scenarios = test.NegativeAutoTest.generate_scenario(_schema_file) + +Negative tests must be marked with a negative attribute:: + + @test.attr(type=['negative', 'gate']) + def test_get_console_output(self): + self.execute(self._schema_file) -The second requirement is that all negative tests must be added to a negative -test file. If such a file doesn't exist for the particular resource being -tested a new test file should be added. +All negative tests should be added into a separate negative test file. +If such a file doesn't exist for the particular resource being tested a new +test file should be added. Old XML based negative tests can be kept but should +be renamed to `_xml.py`. Test skips because of Known Bugs -------------------------------- |