Replace redundant staticness test with $static_or_dynamic check.
[matthijs/upstream/blosxom.git] / t / README
1 Running Tests
2 =============
3
4   prove *.t
5
6
7
8 Test Layout
9 ===========
10
11 To add a new test, you want to add two things - a test script (which
12 is typically just a symlink to the main 'driver' script), and a test
13 directory. To add a new test directory, you're probably best just to 
14 copy one of the existing ones - 'templates' is a good choice:
15
16   cp -rp templates newtest
17
18 Test directory layout is as follows, using 'templates' as an example:
19
20   templates
21   |-- config
22   |   `-- blosxom.conf
23   |-- data
24   |   |-- 1.txt
25   |   |-- 1.txt.200607192254
26   |   |-- content_type.html
27   |   |-- date.html
28   |   |-- foot.html
29   |   |-- head.html
30   |   `-- story.html
31   |-- expected.html
32   `-- spec.yaml
33
34 The 'config' directory contains the config files for this blosxom
35 instance, which is minimally a 'blosxom.conf' file with the $data_dir
36 variable pointing to the 'data' directory. Customising this is 
37 optional.
38
39 The 'data directory' is the set of stories or posts you want to use
40 for your test, and any flavour files you want. Stories may optionally be 
41 suffixed with a numeric timestamp (format YYYYMMDDHHMI) like the 
42 '1.txt.200607192254' entry above, which is used to set the modify time
43 of the story explicitly (since CVS does not store mtimes). Providing 
44 flavour files is recommended so that your tests don't break if the 
45 default flavours change. 
46  
47 At the top level of the test directory are a set of one or more
48 expected output files, and the spec.yaml files which controls the set
49 of tests that are run. For templates, the spec.yaml looks like this:
50
51   tests:
52     - 
53       - ""
54       - expected.html
55
56 This lists the set of tests to be run (in this case just a single test).
57 Each test requires a list of two arguments - the arguments to path to
58 blosxom.cgi (in this case none, an empty string), and a file containing
59 the expected output. So this test will execute blosxom.cgi with no 
60 arguments, and compare the output produced against that contained in
61 the 'expected.html' file.
62
63 A longer spec.yaml example is:
64
65   tests:
66     - 
67       - ""
68       - expected.html
69     -
70       - path=/foo
71       - expected.html
72     -
73       - path=/foo/bar.html
74       - expected.bar
75
76 This defines three tests, one with no arguments, one with a path of 
77 /foo, and a third with a path of /foo/bar.html.
78