on master help sign in
compaREST/test/README.md
37 lines 1.4 kB history raw
1# Golden tests
3## The basics
5The `test/golden` directory contains a tree with golden tests. A test is a any nested directory with no folders nested inside it (i. e. tests can only be leaves in the file system):
7```
8id
9├── a.yaml
10├── b.yaml
11└── report.yaml
12```
14All of the files and their meaning are specified in code:
17```haskell
18tests :: IO TestTree
19tests =
20 goldenInputsTreeUniform
21 "Golden Reports"
22 "test/golden/common"
23 "report.yaml"
24 ("a.yaml", "b.yaml")
25 Yaml.decodeFileThrow
26 (uncurry reportCompat)
27```
29This test would read the files `a.yaml` and `b.yaml` using the `Yaml.decodeFileThrow` function, and pass the resulting tuple to `uncurry reportCompat`. The resul will be compared to `report.yaml`.
31## Supported feature tests
33If a test starts with either `x ` or `v `, the test is assumed to test the support of some OpenAPI functionality. If the test begins `x ` it means that the feature is expected to be not supported, and the result will only be checked to have an "unsupported" flag set. If it starts with `v ` the test is expected to be supported and the result is compared to some file on disk.
35The result will be reflected in the generated compatibility matrix.
37If a test does not begin with either `x ` or `v `, then it is presumed to be a normal test and will not be reflected in the resulting compatibility matrix.