-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
131 lines (93 loc) · 4.34 KB
/
README
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
d t e s t e r
a component based test suite for distributed systems
version 0.2dev
Copyright (c) 2006-2015 Markus Wanner
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE).
Abstract
========
Dtester is an event driven test harness specifically targetting distributed
systems and designed to ease reuse and rearrangment of test components. It
doesn't only run tests, but controls the system under test, its setup and
the (possibly concurrent) execution of tests.
Dtester originates from the Postgres-R project and is mostly used for testing
Postgres.
Installation
============
dtester comes with the usual setup.py script, using setuptools. It knows the
following commands, which are used for building, testing and system-wide
installation.
python setup.py build
python setup.py dtest
sudo python setup.py install
The dtest command is a dtester specific addition, which runs a trivial
self-testing test suite.
Lifecycle of a Test
===================
All tests and test suites, including skipped ones normally proceed through
the following stages: waiting (for dependencies), starting, running,
stopping, and terminated (whether successful or not). During these stages,
various events may occur. The following diagram tries to outline the possible
combinations.
states . succ. events . failure events
. .
. .
waiting .
\ .
ready to run .
/ .
starting --------------->----------------> set up failed
\ . |
set up . |
/ . |
running ----------------> error running test |
\ . | |
done . v |
/ . | |
+---------------<-------------+------<------'
/ .
stopping -----------------> tear down failed
\ . |
torn down . v
/ . |
terminated <------------------------'
. .
. .
Running Conditions
==================
A test may depend on a suite via the 'uses' or 'depends' definition. Both
of these dependencies require the suite to have successfully started *before*
running the test and keep the suite running until *after* the test completed.
In case the suite terminates unexpectedly due to an error, the test is
aborted immediately.
The 'use' definition satisfies requirements of a test, i.e. the test gets the
suite passed as an argument and may use its functions. Whereas the 'depends'
definition only affects the ordering of running suites and tests. There's no
programmatic relation between the suite a a test that depends on the suite.
This distinction is required to keep tests and their requirements as general
as possible, while still providing the ability to control the order of
execution of suites and tests.
Note that this distinction between 'uses' and 'depends' might vanish in the
future.
Dtester currently also supports 'onlyAfter' dependencies. These tell the
runner to start the dependent test only after successful execution of the
other test(s) listed in the 'onlyAfter' dependency.
Tests vs. Suites
================
The TestSuite class is derived from the BaseTest, so it's clearly also a
Test. However, the runner doesn't execute the run method for suites. Instead,
suites have setUp and tearDown methods. Note however, that suites may set up
a service which may fail (and thus throw an exception) in between setUp and
tearDown. Dtester tries to handle these cases gracefully and aborts
concurrently running tests with an error.
Building the apidocs
====================
The apidocs are created with pydoctor, the same tool that twisted
uses. Since at least Debian 8.0 (jessie), packages for pydoctor should
be available on that distribution. Otherwise, please fetch epydoc and
pydoctor.
To generate the actual apidocs run:
# pydoctor --add-package dtester --project-name dtester --make-html
Copyright (c) 2006-2015 Markus Wanner
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE).