Skip to content

Commit cae846a

Browse files
Merge pull request #37 from ricardogsilva/improve-docs
fleshing out standalone section of docs
2 parents b8c65d2 + dfdbdd2 commit cae846a

File tree

8 files changed

+236
-59
lines changed

8 files changed

+236
-59
lines changed

docs/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ into an instance of `models.TestSuiteResult`, its internal data structure.From
2727
there, it is able to serialize it into either JSON or markdown.
2828

2929

30-
### Setting up a develoment environment
30+
### Setting up a development environment
3131

3232
In a brief nutshell:
3333

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Key features:
1111

1212
- **Runs as a github action**: Can be integrated into existing CI workflows
1313
- **Runs as a standalone CLI application**: Can be run as a standalone tool
14-
- **Multiple output formats**: Can output test suite results as markdown,
14+
- **Multiple output formats**: Can output test suite results as straight to the terminal in markdown,
1515
JSON or XML
1616

1717
This project aims to simplify the running of OGC CITE tests suites so that

docs/running-as-standalone-cli.md

Lines changed: 205 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ hide:
88

99
## Installation
1010

11-
!!! note
11+
!!! info
1212

1313
cite-runner will likely be available on the Python Package Index in the
1414
near future. That is not the case yet.
1515

16+
!!! warning
17+
18+
This also means that for the moment, cite-runner needs to be run through poetry, by means of using
19+
`poetry run cite-runner`. As such, please remember to prefix all examples provided below with
20+
`poetry run`.
21+
22+
1623
In order to use cite-runner locally you will need to have [git] and [poetry]
1724
installed. Once these are installed, cite-runner can be installed by cloning
1825
this repository and using poetry to install it:
@@ -29,49 +36,218 @@ You can verify the installation by running
2936
poetry run cite-runner --help
3037
```
3138

32-
##### Starting a local teamengine instance
3339

34-
cite-runner is a [teamengine] runner. the OGC application used for running
35-
test suites. As such
40+
#### Starting a local teamengine instance
41+
42+
cite-runner is a local runner for executing [OGC TEAM Engine] (aka teamengine). teamengine is the OGC application used
43+
for running test suites. As such, in order to use cite-runner, you also need to have an instance of
44+
teamengine at hand.
45+
46+
One way of running teamengine is by pulling its [docker image] and
47+
running it locally. You can achieve this by running:
48+
49+
```shell
50+
docker pull ogccite/teamengine-production:1.0-SNAPSHOT
51+
docker run \
52+
--rm \
53+
--name=teamengine \
54+
--network=host \
55+
ogccite/teamengine-production:1.0-SNAPSHOT
56+
```
57+
58+
This will spawn a teamengine instance, which will be running locally on port `8080` - it will thus be accessible
59+
at:
60+
61+
<http://localhost:8080/teamengine>
62+
63+
!!! warning
64+
65+
cite-runner has been implemented to work with the teamengine version that is used in
66+
the `ogccite/teamengine-production:1.0-SNAPSHOT` docker image as this is documented as
67+
being the same version used in the OGC production system.
68+
69+
At the time of writing, this means **cite-runner is known to work with teamengine version
70+
5.6.1**.
71+
72+
cite-runner has not been tested with other versions of teamengine.
3673

3774

38-
### Usage
75+
## Usage
3976

40-
cite-runner is executed by calling the `cite-runner` command with a sub-command
41-
and suitable arguments. For example:
77+
Once installed, cite-runner can be executed by calling the `cite-runner` application with a command
78+
and suitable arguments.
4279

4380
```shell
44-
poetry run cite-runner execute-test-suite \
45-
http://localhost:8080/teamengine \
46-
ogcapi-features-1.0 \
47-
--test-suite-input iut http://localhost:5000 \
48-
--test-suite-input noofcollections -1
81+
cite-runner [OPTIONS] COMMAND [ARGS] ...
4982
```
5083

84+
!!! tip
5185

52-
##### Sub-commands
86+
The `--help` option can be used to discover how to use cite-runner interactively, like this:
5387

54-
3. Start your service to be tested. Let's assume it is already running on `http://localhost:5000`
88+
```shell
89+
cite-runner --help
90+
```
5591

56-
4. Run the teamengine docker image locally:
92+
## Commands
5793

58-
```shell
59-
docker run \
60-
--rm \
61-
--name teamengine \
62-
--network=host \
63-
ogccite/teamengine-production:1.0-SNAPSHOT
64-
```
94+
### execute-test-suite
95+
96+
Execute a teamengine CITE test suite and get its result.
97+
98+
Results are serialized with the requested output format and are printed to the application's standard output stream,
99+
which is usually the terminal. If needed, you can redirect the output to a file.
100+
101+
```shell
102+
cite runner execute-test-suite [OPTIONS] TEAMENGINE_BASE_URL TEST_SUITE_IDENTIFIER
103+
```
104+
105+
106+
##### Arguments
107+
108+
- `TEAMENGINE_BASE_URL` - Base URL of the teamengine service. Example: `http://localhost:8080/teamengine`
109+
- `TEST_SUITE_IDENTIFIER` - Identifier of the test suite as known to teamengine. Example: `ogcapi-features-1.0`
110+
111+
112+
##### Options
113+
114+
| name | description |
115+
| ---- | ----------- |
116+
| `--help` | Show information on how to run the command, including a description of arguments and options |
117+
| `--teamengine-username` | Username for authenticating with teamengine |
118+
| `--teamengine-password` | Password for authenticating with teamengine |
119+
| `--test-suite-input` | Inputs expected by teamengine for running the test suite specified with TEST_SUITE_IDENTIFIER. These vary depending on the test suite.<br><br>This parameter can be specified multiple times.<br><br>Each parameter must be specified as a name and a value, separated by the space character (_i.e._ `--test-suite-input {name} {value}`).<br><br>Example: `--test-suite-input iut http://localhost:5000 --test-suite-input noofcollections -1`|
120+
| `--output-format` | Format for the cite-runner result. Available options are:<br><ul><li><code>markdown</code> - Return results as a markdown document - This is the default</li><li><code>json</code> - Return results as JSON</li><li><code>console</code> - Return results in a format suitable for reading in the terminal</li><li><code>raw</code> - Return the raw results as provided by teamengine. This is an XML document</li></ul>
121+
| `--include-summary`/`--no-include-summary` | Whether the output should include a summary. This is enabled by default. Disable it by providing `--no-include-summary` |
122+
| `--include-failed-detail`/`--no-include-failed-detail` | Whether the output should include a section with details about failed tests. This is enabled by default, disable it by providing `--no-include-summary`.|
123+
| `--include-skipped-detail`/`--no-include-skipped-detail` | Whether the output should include a section with details about skipped tests. This is enabled by default, disable it by providing `--no-include-summary`.|
124+
| `--include-passed-detail`/`--no-include-passed-detail` | Whether the output should include a section with details about passed tests. This is disabled by default, enable it by providing `--include-summary`.|
125+
| `--exit-with-error-on-suite-failed-result`/`--no-exit-with-error-on-suite-failed-result` | Whether the application should exit with an error code when a suite is declared as not failed. This is disabled by default, enable it by providing `--exit-with-error-on-suite-failed-result`|
126+
127+
128+
##### Examples
129+
130+
1. Run the test suite for OGC API Features, using a service that is running locally on port 5000 and then output just the
131+
result summary to the terminal:
132+
133+
```shell
134+
cite-runner execute-test-suite \
135+
http://localhost:8080/teamengine \
136+
ogcapi-features-1.0 \
137+
--test-suite-input iut http://localhost:5000 \
138+
--test-suite-input noofcollections -1 \
139+
--output-format console \
140+
--no-include-skipped-detail \
141+
--no-include-failed-detail
142+
```
143+
144+
2. Run the test suite for OGC API Features using the [pygeoapi demo service] and then output the
145+
full report in markdown format, redirecting the output to the `result.md` file:
146+
147+
```shell
148+
cite-runner execute-test-suite \
149+
http://localhost:8080/teamengine \
150+
ogcapi-processes-1.0 \
151+
--test-suite-input iut https://demo.pygeoapi.io/stable \
152+
--test-suite-input noofcollections -1 \
153+
--include-passed-detail \
154+
> result.md
155+
```
156+
157+
3. Run the test suite for OGC API Processes using a service that is running locally on port 5000 and then output the
158+
full report in JSON format, piping it to `jq` for further filtering:
159+
160+
```shell
161+
cite-runner execute-test-suite \
162+
http://localhost:8080/teamengine \
163+
ogcapi-processes-1.0 \
164+
--test-suite-input iut http://localhost:5000 \
165+
--test-suite-input noofcollections -1 \
166+
--include-passed-detail \
167+
| jq '.passed'
168+
```
169+
170+
171+
### parse-result
172+
173+
Parse previously gotten results from an earlier cite-runner run that used `raw` as its output format.
174+
175+
This command is most useful when you want to produce multiple reports in different output formats or with different
176+
details from the same test run.
177+
178+
##### Arguments
179+
180+
- `TEST_SUITE_RESULT` - Path to an XML file containing the raw execution results of a previous cite-runner run. You
181+
can also use a raw result file generated by teamengine, as long as it is has been generated with
182+
[teamengine EARL output format]
183+
184+
185+
##### Options
186+
187+
Accepts a subset of similar [options as the execute-test-suite-command](#options) namely:
188+
189+
- `--output-format`
190+
- `--include-summary`/`--no-include-summary`
191+
- `--include-failed-detail`/`--no-include-failed-detail`
192+
- `--include-skipped-detail`/`--no-include-skipped-detail`
193+
- `--include-passed-detail`/`--no-include-passed-detail`
194+
- `--exit-with-error-on-suite-failed-result`/`--no-exit-with-error-on-suite-failed-result`
195+
196+
197+
##### Examples
198+
199+
1. Parse a previously generated `raw-results.xml` and output results for consumption in the terminal:
200+
201+
```shell
202+
cite-runner parse-result raw-results.xml --output-format console
203+
```
204+
205+
2. Run the OGC API Features test suite, then save the raw results in the `raw-results.xml` file and then parse
206+
them into a markdown report
207+
208+
```shell
209+
cite-runner execute-test-suite \
210+
http://localhost:8080/teamengine \
211+
ogcapi-processes-1.0 \
212+
--test-suite-input iut http://localhost:5000 \
213+
--test-suite-input noofcollections -1 \
214+
--output-format raw
215+
> raw-results.xml
216+
217+
cite-runner parse-result raw-results.xml --include-passed-detail > parsed-results.md
218+
219+
```
220+
221+
222+
### execute-test-suite-from-github-actions
223+
224+
This command is merely a convenience for when executing cite-runner via github actions. When running cite-runner
225+
as a standalone tool you should prefer to use the [execute-test-suite command](#execute-test-suite) instead
226+
227+
## Global options
228+
229+
cite-runner includes a couple of global options. These are mainly useful for debugging. They must to be provided
230+
before the command.
231+
232+
233+
| name | description |
234+
| ---- | ----------- |
235+
| `--debug`/`--no-debug` | Whether to run cite-runner in debug mode or not. Debug mode provides additional runtime information, which can be used during development. This is disabled by default, enable it by providing `--debug`|
236+
| `--network-timeout` | How many seconds to use as the timeout parameter when contacting the teamengine service. The default value is `120` |
237+
238+
##### Examples
239+
240+
1. Run cite-runner in debug mode:
65241

66-
- Run the action code with
242+
```shell
243+
cite-runner --debug parse-result raw-results.xml --output-format console
244+
```
67245

68-
```shell
69-
poetry run cite-runner --help
70-
```
71246

72-
There are additional commands and options which can be used when running locally, which allow controlling the output
73-
format and how the inputs are supplied. Read the online
74247

248+
[docker image]: https://hub.docker.com/r/ogccite/teamengine-production
75249
[git]: https://git-scm.com/
76250
[poetry]: https://python-poetry.org/
77-
[teamengine]:
251+
[pygeoapi demo service]: https://demo.pygeoapi.io/stable
252+
[OGC TEAM Engine]: https://opengeospatial.github.io/teamengine/
253+
[teamengine EARL output format]: https://opengeospatial.github.io/teamengine/users.html#EARL_.28RDF.2FXML.29

src/cite_runner/config.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ def configure_logging(rich_console: Console, debug: bool) -> None:
7373

7474

7575
def get_console() -> Console:
76-
return Console(
77-
stderr=True,
78-
)
76+
return Console()
7977

8078

8179
def get_context(

0 commit comments

Comments
 (0)