Update docs with --parallel option.

This commit is contained in:
Jean-Christophe Amiel 2024-06-09 21:10:30 +02:00
parent 6a5eab3593
commit ce856f92c9
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
10 changed files with 67 additions and 40 deletions

View File

@ -44,7 +44,7 @@ _hurl() {
'--interactive[Turn on interactive mode]' \
'(-4 --ipv4)'{-4,--ipv4}'[Tell Hurl to use IPv4 addresses only when resolving host names, and not for example try IPv6]' \
'(-6 --ipv6)'{-6,--ipv6}'[Tell Hurl to use IPv6 addresses only when resolving host names, and not for example try IPv4]' \
'--jobs[(Experimental) Maximum number of parallel jobs]: :' \
'--jobs[Maximum number of parallel jobs]: :' \
'--json[Output each Hurl file result to JSON]' \
'--max-filesize[Specify the maximum size (in bytes) of a file to download]: :' \
'--max-redirs[Maximum number of redirects allowed, -1 for unlimited redirects]: :' \
@ -56,7 +56,7 @@ _hurl() {
'--no-output[Suppress output. By default, Hurl outputs the body of the last response]' \
'--noproxy[List of hosts which do not use proxy]: :' \
'(-o --output)'{-o,--output}'[Write to FILE instead of stdout]: :_files' \
'--parallel[(Experimental) Run files in parallel]' \
'--parallel[Run files in parallel (default in test mode)]' \
'--path-as-is[Tell Hurl to not handle sequences of /../ or /./ in the given URL path]' \
'(-x --proxy)'{-x,--proxy}'[Use proxy on given PROTOCOL/HOST/PORT]: :' \
'--report-html[Generate HTML report to DIR]: :' \
@ -67,7 +67,7 @@ _hurl() {
'--retry[Maximum number of retries, 0 for no retries, -1 for unlimited retries]: :' \
'--retry-interval[Interval in milliseconds before a retry]: :' \
'--ssl-no-revoke[(Windows) Tell Hurl to disable certificate revocation checks]' \
'--test[Activate test mode]' \
'--test[Activate test mode (use parallel execution)]' \
'--to-entry[Execute Hurl file to ENTRY_NUMBER (starting at 1)]: :' \
'--unix-socket[(HTTP) Connect through this Unix domain socket, instead of using the network]: :_files' \
'(-u --user)'{-u,--user}'[Add basic Authentication header to each request]: :' \

View File

@ -49,7 +49,7 @@ Register-ArgumentCompleter -Native -CommandName 'hurl' -ScriptBlock {
[CompletionResult]::new('--interactive', 'interactive', [CompletionResultType]::ParameterName, 'Turn on interactive mode')
[CompletionResult]::new('--ipv4', 'ipv4', [CompletionResultType]::ParameterName, 'Tell Hurl to use IPv4 addresses only when resolving host names, and not for example try IPv6')
[CompletionResult]::new('--ipv6', 'ipv6', [CompletionResultType]::ParameterName, 'Tell Hurl to use IPv6 addresses only when resolving host names, and not for example try IPv4')
[CompletionResult]::new('--jobs', 'jobs', [CompletionResultType]::ParameterName, '(Experimental) Maximum number of parallel jobs')
[CompletionResult]::new('--jobs', 'jobs', [CompletionResultType]::ParameterName, 'Maximum number of parallel jobs')
[CompletionResult]::new('--json', 'json', [CompletionResultType]::ParameterName, 'Output each Hurl file result to JSON')
[CompletionResult]::new('--max-filesize', 'max-filesize', [CompletionResultType]::ParameterName, 'Specify the maximum size (in bytes) of a file to download')
[CompletionResult]::new('--max-redirs', 'max-redirs', [CompletionResultType]::ParameterName, 'Maximum number of redirects allowed, -1 for unlimited redirects')
@ -61,7 +61,7 @@ Register-ArgumentCompleter -Native -CommandName 'hurl' -ScriptBlock {
[CompletionResult]::new('--no-output', 'no-output', [CompletionResultType]::ParameterName, 'Suppress output. By default, Hurl outputs the body of the last response')
[CompletionResult]::new('--noproxy', 'noproxy', [CompletionResultType]::ParameterName, 'List of hosts which do not use proxy')
[CompletionResult]::new('--output', 'output', [CompletionResultType]::ParameterName, 'Write to FILE instead of stdout')
[CompletionResult]::new('--parallel', 'parallel', [CompletionResultType]::ParameterName, '(Experimental) Run files in parallel')
[CompletionResult]::new('--parallel', 'parallel', [CompletionResultType]::ParameterName, 'Run files in parallel (default in test mode)')
[CompletionResult]::new('--path-as-is', 'path-as-is', [CompletionResultType]::ParameterName, 'Tell Hurl to not handle sequences of /../ or /./ in the given URL path')
[CompletionResult]::new('--proxy', 'proxy', [CompletionResultType]::ParameterName, 'Use proxy on given PROTOCOL/HOST/PORT')
[CompletionResult]::new('--report-html', 'report-html', [CompletionResultType]::ParameterName, 'Generate HTML report to DIR')
@ -72,7 +72,7 @@ Register-ArgumentCompleter -Native -CommandName 'hurl' -ScriptBlock {
[CompletionResult]::new('--retry', 'retry', [CompletionResultType]::ParameterName, 'Maximum number of retries, 0 for no retries, -1 for unlimited retries')
[CompletionResult]::new('--retry-interval', 'retry-interval', [CompletionResultType]::ParameterName, 'Interval in milliseconds before a retry')
[CompletionResult]::new('--ssl-no-revoke', 'ssl-no-revoke', [CompletionResultType]::ParameterName, '(Windows) Tell Hurl to disable certificate revocation checks')
[CompletionResult]::new('--test', 'test', [CompletionResultType]::ParameterName, 'Activate test mode')
[CompletionResult]::new('--test', 'test', [CompletionResultType]::ParameterName, 'Activate test mode (use parallel execution)')
[CompletionResult]::new('--to-entry', 'to-entry', [CompletionResultType]::ParameterName, 'Execute Hurl file to ENTRY_NUMBER (starting at 1)')
[CompletionResult]::new('--unix-socket', 'unix-socket', [CompletionResultType]::ParameterName, '(HTTP) Connect through this Unix domain socket, instead of using the network')
[CompletionResult]::new('--user', 'user', [CompletionResultType]::ParameterName, 'Add basic Authentication header to each request')

View File

@ -27,7 +27,7 @@ complete -c hurl -l insecure -d 'Allow insecure SSL connections'
complete -c hurl -l interactive -d 'Turn on interactive mode'
complete -c hurl -l ipv4 -d 'Tell Hurl to use IPv4 addresses only when resolving host names, and not for example try IPv6'
complete -c hurl -l ipv6 -d 'Tell Hurl to use IPv6 addresses only when resolving host names, and not for example try IPv4'
complete -c hurl -l jobs -d '(Experimental) Maximum number of parallel jobs'
complete -c hurl -l jobs -d 'Maximum number of parallel jobs'
complete -c hurl -l json -d 'Output each Hurl file result to JSON'
complete -c hurl -l max-filesize -d 'Specify the maximum size (in bytes) of a file to download'
complete -c hurl -l max-redirs -d 'Maximum number of redirects allowed, -1 for unlimited redirects'
@ -39,7 +39,7 @@ complete -c hurl -l no-color -d 'Do not colorize output'
complete -c hurl -l no-output -d 'Suppress output. By default, Hurl outputs the body of the last response'
complete -c hurl -l noproxy -d 'List of hosts which do not use proxy'
complete -c hurl -l output -d 'Write to FILE instead of stdout'
complete -c hurl -l parallel -d '(Experimental) Run files in parallel'
complete -c hurl -l parallel -d 'Run files in parallel (default in test mode)'
complete -c hurl -l path-as-is -d 'Tell Hurl to not handle sequences of /../ or /./ in the given URL path'
complete -c hurl -l proxy -d 'Use proxy on given PROTOCOL/HOST/PORT'
complete -c hurl -l report-html -d 'Generate HTML report to DIR'
@ -50,7 +50,7 @@ complete -c hurl -l resolve -d 'Provide a custom address for a specific HOST and
complete -c hurl -l retry -d 'Maximum number of retries, 0 for no retries, -1 for unlimited retries'
complete -c hurl -l retry-interval -d 'Interval in milliseconds before a retry'
complete -c hurl -l ssl-no-revoke -d '(Windows) Tell Hurl to disable certificate revocation checks'
complete -c hurl -l test -d 'Activate test mode'
complete -c hurl -l test -d 'Activate test mode (use parallel execution)'
complete -c hurl -l to-entry -d 'Execute Hurl file to ENTRY_NUMBER (starting at 1)'
complete -c hurl -l unix-socket -d '(HTTP) Connect through this Unix domain socket, instead of using the network'
complete -c hurl -l user -d 'Add basic Authentication header to each request'

View File

@ -297,7 +297,7 @@ This option tells Hurl to use IPv6 addresses only when resolving host names, and
### --jobs <NUM> {#jobs}
(Experimental) Maximum number of parallel jobs in parallel mode. Default value corresponds (in most cases) to the
Maximum number of parallel jobs in parallel mode. Default value corresponds (in most cases) to the
current amount of CPUs.
See also [`--parallel`](#parallel).
@ -385,9 +385,9 @@ Write output to FILE instead of stdout.
### --parallel {#parallel}
(Experimental) Run files in parallel.
Run files in parallel.
Each Hurl file is executed in its own worker thread, without sharing anything with the other workers. The default run mode is sequential.
Each Hurl file is executed in its own worker thread, without sharing anything with the other workers. The default run mode is sequential. Parallel execution is by default in [`--test`](#test) mode.
See also [`--jobs`](#jobs).
@ -455,6 +455,10 @@ This is a cli-only option.
Activate test mode: with this, the HTTP response is not outputted anymore, progress is reported for each Hurl file tested, and a text summary is displayed when all files have been run.
In test mode, files are executed in parallel. To run test in a sequential way use `--job 1`.
See also [`--jobs`](#jobs).
This is a cli-only option.
### --to-entry <ENTRY_NUMBER> {#to-entry}

View File

@ -24,37 +24,35 @@ test tool with an adapted output, you can use [`--test` option]:
```shell
$ hurl --test hello.hurl assert_json.hurl
hello.hurl: Running [1/2]
hello.hurl: Success (6 request(s) in 245 ms)
assert_json.hurl: Running [2/2]
assert_json.hurl: Success (8 request(s) in 308 ms)
--------------------------------------------------------------------------------
Executed files: 2
Succeeded files: 2 (100.0%)
Failed files: 0 (0.0%)
Duration: 561 ms
Executed files: 2
Executed requests: 10 (17.82/s)
Succeeded files: 2 (100.0%)
Failed files: 0 (0.0%)
Duration: 561 ms
```
Or, in case of errors:
```shell
$ hurl --test hello.hurl error_assert_status.hurl
hello.hurl: Running [1/2]
hello.hurl: Success (6 request(s) in 258 ms)
assert_json.hurl: Running [2/2]
error: Assert status code
--> assert_json.hurl:6:8
|
 6 | HTTP/* 200
 6 | HTTP 200
| ^^^ actual value is <301>
|
assert_json.hurl: Failure (5 request(s) in 230 ms)
--------------------------------------------------------------------------------
Executed files: 2
Succeeded files: 1 (50.0%)
Failed files: 1 (50.0%)
Duration: 499 ms
Executed files: 2
Executed requests: 7 (14.02/s)
Succeeded files: 1 (50.0%)
Failed files: 1 (50.0%)
Duration: 499 ms
```
You can use [`--glob` option] to test files that match a given pattern:
@ -63,11 +61,22 @@ You can use [`--glob` option] to test files that match a given pattern:
$ hurl --test --glob "test/integration/**/*.hurl"
```
In test mode, files are executed in parallel to speed-ud the execution. If a sequential run is needed, you can use
[`--jobs 1`] option to execute one test by one test.
```shell
$ hurl --test --jobs 1 *.hurl
```
## Generating Report
In the different reports, files are always referenced in the input order (which, as tests are executed in parallel, can
be different from the execution order).
### HTML Report
Hurl can generate an HTML report by using the [`--report-html HTML_DIR`] option.
Hurl can generate an HTML report by using the [`--report-html DIR`] option.
If the HTML report already exists, the test results will be appended to it.
@ -83,6 +92,12 @@ The input Hurl files (HTML version) are also included and are easily accessed fr
### JSON Report
A JSON report can be produced by using the [`--report-json DIR`]. The report directory will contain a `report.json`
file, including each test file executed with [`--json`] option and a reference to each HTTP response of the run dumped
to disk.
If the JSON report already exists, it will be updated with the new test results.
### JUnit Report
A JUnit report can be produced by using the [`--report-junit FILE`] option.
@ -107,7 +122,8 @@ You will find a detailed description in the [Injecting Variables] section of the
[`--output /dev/null`]: /docs/manual.md#output
[`--test`]: /docs/manual.md#test
[`--report-html HTML_DIR`]: /docs/manual.md#report-html
[`--report-html DIR`]: /docs/manual.md#report-html
[`--report-json DIR`]: /docs/manual.md#report-json
[`--report-junit FILE`]: /docs/manual.md#report-junit
[`--report-tap FILE`]: /docs/manual.md#report-tap
[`--test` option]: /docs/manual.md#test
@ -116,3 +132,6 @@ You will find a detailed description in the [Injecting Variables] section of the
[`--variables-file` option]: /docs/manual.md#variables-file
[Injecting Variables]: /docs/templates.md#injecting-variables
[Test Anything Protocol]: https://testanything.org
[`--jobs 1`]: /docs/manual.md#jobs
[`--json`]: /docs/manual.md#json

View File

@ -2,10 +2,10 @@ name: jobs
long: jobs
value: NUM
value_parser: clap::value_parser!(u32).range(1..)
help: (Experimental) Maximum number of parallel jobs
help: Maximum number of parallel jobs
cli_only: true
---
(Experimental) Maximum number of parallel jobs in parallel mode. Default value corresponds (in most cases) to the
Maximum number of parallel jobs in parallel mode. Default value corresponds (in most cases) to the
current amount of CPUs.
See also [`--parallel`](#parallel).

View File

@ -1,10 +1,10 @@
name: parallel
long: parallel
help: (Experimental) Run files in parallel
help: Run files in parallel (default in test mode)
cli_only: true
---
(Experimental) Run files in parallel.
Run files in parallel.
Each Hurl file is executed in its own worker thread, without sharing anything with the other workers. The default run mode is sequential.
Each Hurl file is executed in its own worker thread, without sharing anything with the other workers. The default run mode is sequential. Parallel execution is by default in [`--test`](#test) mode.
See also [`--jobs`](#jobs).

View File

@ -1,6 +1,10 @@
name: test
long: test
help: Activate test mode
help: Activate test mode (use parallel execution)
cli_only: true
---
Activate test mode: with this, the HTTP response is not outputted anymore, progress is reported for each Hurl file tested, and a text summary is displayed when all files have been run.
In test mode, files are executed in parallel. To run test in a sequential way use `--job 1`.
See also [`--jobs`](#jobs).

View File

@ -1,6 +1,6 @@
Hurl, run and test HTTP requests with plain text
Usage: hurl<<<.*?>>> [OPTIONS] [FILES]...
Usage: hurl<<<(\.exe)?>>> [OPTIONS] [FILES]...
Arguments:
[FILES]... Set the input file to use
@ -66,7 +66,7 @@ Options:
Tell Hurl to use IPv6 addresses only when resolving host names, and not for example try
IPv4
--jobs <NUM>
(Experimental) Maximum number of parallel jobs
Maximum number of parallel jobs
--json
Output each Hurl file result to JSON
--max-filesize <BYTES>
@ -90,7 +90,7 @@ Options:
-o, --output <FILE>
Write to FILE instead of stdout
--parallel
(Experimental) Run files in parallel
Run files in parallel (default in test mode)
--path-as-is
Tell Hurl to not handle sequences of /../ or /./ in the given URL path
-x, --proxy <[PROTOCOL://]HOST[:PORT]>
@ -112,7 +112,7 @@ Options:
--ssl-no-revoke
(Windows) Tell Hurl to disable certificate revocation checks
--test
Activate test mode
Activate test mode (use parallel execution)
--to-entry <ENTRY_NUMBER>
Execute Hurl file to ENTRY_NUMBER (starting at 1)
--unix-socket <PATH>

View File

@ -269,7 +269,7 @@ pub fn jobs() -> clap::Arg {
.long("jobs")
.value_name("NUM")
.value_parser(clap::value_parser!(u32).range(1..))
.help("(Experimental) Maximum number of parallel jobs")
.help("Maximum number of parallel jobs")
.num_args(1)
}
@ -375,7 +375,7 @@ pub fn output() -> clap::Arg {
pub fn parallel() -> clap::Arg {
clap::Arg::new("parallel")
.long("parallel")
.help("(Experimental) Run files in parallel")
.help("Run files in parallel (default in test mode)")
.action(clap::ArgAction::SetTrue)
}
@ -467,7 +467,7 @@ pub fn ssl_no_revoke() -> clap::Arg {
pub fn test() -> clap::Arg {
clap::Arg::new("test")
.long("test")
.help("Activate test mode")
.help("Activate test mode (use parallel execution)")
.action(clap::ArgAction::SetTrue)
}