source: cows_wps/trunk/TESTING.txt @ 5615

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows_wps/trunk/TESTING.txt@7084
Revision 5615, 3.5 KB checked in by spascoe, 10 years ago (diff)

COWS WPS package copied from
 http://proj.badc.rl.ac.uk/svn/dcip/cows-wps/trunk.

This is a stripped down version of the DDP WPS. Some features are
removed and others have been deactivated until we reimplement them in a
more generic way.

Line 
1
2Prerequisites
3=============
4
5To successfuly run the tests you will need:
6
7 1. the nose package
8 2. The latest COWS package.  At least cows-0.2rc2_r4228.
9 3. SGE configured and SGE_ROOT set.
10
11Running the Tests
12=================
13
14You run the tests in one of 2 ways:
15
16  $ python setup.py test
17
18OR
19
20  $ nosetests
21
22This will run all tests in the cows_wps/tests directory (as configured
23in setup.cfg).  There are many other tests dotted around the codebase
24that can be run by nosetests by overriding the default:
25
26  $ nosetests cows_wps
27
28However, some of these tests are out of date.  When they are of
29sufficient quality to qualify as official tests they should be moved
30to the cows_wps/tests directory (and refactored as necessary)
31   
32The above will add cows_wps to the list of tests, if you want to exclude
33the default tests and just run a specific test use (for example)
34
35  $ nosetests --tests=cows_wps.tests.workflow
36
37Test files
38==========
39
40Nosetests uses a complex heuristic for discovering tests (google
41python nose).  It is configured to look in the cows_wps.tests module
42and discover both code tests and doctest files.
43
44Code tests can be unittest.TestCase instances or functions starting
45"test_".  See the nose documentation.
46
47Doctests start *.txt.  See the python doctest module documentation.
48
49Test framework layout
50=====================
51
52  - cows_wps/tests     
53    - data              [1]
54    - functional        [2]
55    - workflow          [3]
56
57
58[1] Used to store data required for tests.  Not current needed for
59active tests.
60
61[2] Controller unittests.  Paster will create controller testing stubs
62in here automatically.
63
64[3] Narative tests that test a workflow through the system.  These are
65best written as doctests.
66
67
68Test Environment Isolation
69==========================
70
71The framework automatically uses an in-memory sql database for running
72the tests.  Further isolation of the WPS state (such as a separate
73proc_outputs directory) will be added soon).
74
75The ini file test.ini overrides paste options to setup the test environment.
76
77Guidance on writing tests
78=========================
79
80Although it's fine to use "print" when doing debugging.  Replace
81prints with logging calls in comitted code.  Random print statements
82make writing doctests very difficult.
83
84
85Todo
86=====
87
88 - Migrate old tests to cows_wps/tests
89 - Fully isolate test environment. (make separate proc_outputs dir)
90 - Reinstate cows_wps/tests/_test_examples.py.
91
92
93
94
95
96
97
98
99
100
101Deprecated Documentation
102========================
103
104This is how it used to work but it's changing now.
105
106The UKCIP-DDP uses a set of example URLs to define it's test suite.
107The examples are in cows_wps.examples.  The fefault response from the
108wps controller produces a test page listing each example URL.
109
110You can run these examples as a test suite using "nosetests" or
111"python setup.py test".  The latter has been configured to dump a
112summary of the results to "example_results.txt".  If this file is
113present it is read by the wps controller and used to give user
114feedback on what URLs are working.
115
116To run the tests you must:
117
118 1. Install cows_wps as an egg or develop egg.  Although you can run
119    the server without doing this, the test suite requires a nose
120    plugin that isn't discovered without this step:
121
122    $ python setup.py develop [-d EGG_DIR]
123
124    where EGG_DIR is on your PYTHONPATH or you have privileges to install
125    the develop-egg globally.
126
127 2. Run nose over the example URLs:
128
129    $ python setup.py test
130
131The results file should have been written.  Use cows_wps.examples.example_status to
132read this file.
Note: See TracBrowser for help on using the repository browser.