blob: dcd940b10b7f33ea6f300b59e27183b309d68745 [file] [log] [blame]
Masayuki Igawac268dd62013-09-18 00:51:05 +09001Tempest Field Guide to CLI tests
2================================
Sean Daguef6825792013-05-08 13:51:26 -04003
4
5What are these tests?
Attila Fazekas23fdf1d2013-06-09 16:35:23 +02006---------------------
Sean Daguef6825792013-05-08 13:51:26 -04007The cli tests test the various OpenStack command line interface tools
8to ensure that they minimally function. The current scope is read only
9operations on a cloud that are hard to test via unit tests.
10
11
12Why are these tests in tempest?
Attila Fazekas23fdf1d2013-06-09 16:35:23 +020013-------------------------------
Sean Daguef6825792013-05-08 13:51:26 -040014These tests exist here because it is extremely difficult to build a
Attila Fazekas58d23302013-07-24 10:25:02 +020015functional enough environment in the python-\*client unit tests to
Sean Daguef6825792013-05-08 13:51:26 -040016provide this kind of testing. Because we already put up a cloud in the
17gate with devstack + tempest it was decided it was better to have
18these as a side tree in tempest instead of another QA effort which
19would split review time.
20
21
22Scope of these tests
Attila Fazekas23fdf1d2013-06-09 16:35:23 +020023--------------------
Sean Daguef6825792013-05-08 13:51:26 -040024This should stay limited to the scope of testing the cli. Functional
25testing of the cloud should be elsewhere, this is about exercising the
26cli code.
27
28
29Example of a good test
Attila Fazekas23fdf1d2013-06-09 16:35:23 +020030----------------------
Sean Daguef6825792013-05-08 13:51:26 -040031Tests should be isolated to a single command in one of the python
32clients.
33
34Tests should not modify the cloud.
35
36If a test is validating the cli for bad data, it should do it with
37assertRaises.
38
Michael Chapmanf8263802013-06-25 15:17:24 +100039A reasonable example of an existing test is as follows::
Sean Daguef6825792013-05-08 13:51:26 -040040
41 def test_admin_list(self):
42 self.nova('list')
43 self.nova('list', params='--all-tenants 1')
44 self.nova('list', params='--all-tenants 0')
45 self.assertRaises(subprocess.CalledProcessError,
46 self.nova,
47 'list',
48 params='--all-tenants bad')