blob: 91e6ad6b99c74e067a6e0a0061c8980fdf9805a1 [file] [log] [blame]
Matthew Treinisha9aef872014-07-25 16:03:08 -04001.. _api_field_guide:
2
Masayuki Igawac268dd62013-09-18 00:51:05 +09003Tempest Field Guide to API tests
4================================
Sean Dague1937d092013-05-17 16:36:38 -04005
6
7What are these tests?
Attila Fazekas23fdf1d2013-06-09 16:35:23 +02008---------------------
Sean Dague1937d092013-05-17 16:36:38 -04009
10One of Tempest's prime function is to ensure that your OpenStack cloud
11works with the OpenStack API as documented. The current largest
12portion of Tempest code is devoted to test cases that do exactly this.
13
Yong Sheng Gonge99072d2013-08-15 13:52:41 +080014It's also important to test not only the expected positive path on
Sean Dague1937d092013-05-17 16:36:38 -040015APIs, but also to provide them with invalid data to ensure they fail
16in expected and documented ways. Over the course of the OpenStack
17project Tempest has discovered many fundamental bugs by doing just
18this.
19
Yong Sheng Gonge99072d2013-08-15 13:52:41 +080020In order for some APIs to return meaningful results, there must be
Sean Dague1937d092013-05-17 16:36:38 -040021enough data in the system. This means these tests might start by
Yong Sheng Gonge99072d2013-08-15 13:52:41 +080022spinning up a server, image, etc, then operating on it.
Sean Dague1937d092013-05-17 16:36:38 -040023
24
25Why are these tests in tempest?
Attila Fazekas23fdf1d2013-06-09 16:35:23 +020026-------------------------------
Sean Dague1937d092013-05-17 16:36:38 -040027
28This is one of the core missions for the Tempest project, and where it
29started. Many people use this bit of function in Tempest to ensure
30their clouds haven't broken the OpenStack API.
31
32It could be argued that some of the negative testing could be done
33back in the projects themselves, and we might evolve there over time,
34but currently in the OpenStack gate this is a fundamentally important
35place to keep things.
36
37
38Scope of these tests
Attila Fazekas23fdf1d2013-06-09 16:35:23 +020039--------------------
Sean Dague1937d092013-05-17 16:36:38 -040040
41API tests should always use the Tempest implementation of the
42OpenStack API, as we want to ensure that bugs aren't hidden by the
43official clients.
44
45They should test specific API calls, and can build up complex state if
46it's needed for the API call to be meaningful.
47
48They should send not only good data, but bad data at the API and look
49for error codes.
50
51They should all be able to be run on their own, not depending on the
52state created by a previous test.