mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-09-11 05:35:53 +03:00
Initialize report-json option.
This commit is contained in:
parent
40b59bb8e3
commit
75ab681cbe
@ -1217,6 +1217,7 @@ will follow a redirection only for the second entry.
|
||||
| <a href="#path-as-is" id="path-as-is"><code>--path-as-is</code></a> | Tell Hurl to not handle sequences of /../ or /./ in the given URL path. Normally Hurl will squash or merge them according to standards but with this option set you tell it not to do that.<br> |
|
||||
| <a href="#proxy" id="proxy"><code>-x, --proxy <[PROTOCOL://]HOST[:PORT]></code></a> | Use the specified proxy.<br> |
|
||||
| <a href="#report-html" id="report-html"><code>--report-html <DIR></code></a> | Generate HTML report in DIR.<br><br>If the HTML report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br> |
|
||||
| <a href="#report-json" id="report-json"><code>--report-json <DIR></code></a> | Generate JSON report in DIR.<br><br>If the JSON report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br> |
|
||||
| <a href="#report-junit" id="report-junit"><code>--report-junit <FILE></code></a> | Generate JUnit File.<br><br>If the FILE report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br> |
|
||||
| <a href="#report-tap" id="report-tap"><code>--report-tap <FILE></code></a> | Generate TAP report.<br><br>If the FILE report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br> |
|
||||
| <a href="#resolve" id="resolve"><code>--resolve <HOST:PORT:ADDR></code></a> | Provide a custom address for a specific host and port pair. Using this, you can make the Hurl requests(s) use a specified address and prevent the otherwise normally resolved address to be used. Consider it a sort of /etc/hosts alternative provided on the command line.<br> |
|
||||
|
@ -60,6 +60,7 @@ _hurl() {
|
||||
'--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]: :' \
|
||||
'--report-json[Generate JSON report to DIR]: :' \
|
||||
'--report-junit[Write a JUnit XML report to FILE]: :_files' \
|
||||
'--report-tap[Write a TAP report to FILE]: :_files' \
|
||||
'*--resolve[Provide a custom address for a specific HOST and PORT pair]: :' \
|
||||
|
@ -65,6 +65,7 @@ Register-ArgumentCompleter -Native -CommandName 'hurl' -ScriptBlock {
|
||||
[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')
|
||||
[CompletionResult]::new('--report-json', 'report-json', [CompletionResultType]::ParameterName, 'Generate JSON report to DIR')
|
||||
[CompletionResult]::new('--report-junit', 'report-junit', [CompletionResultType]::ParameterName, 'Write a JUnit XML report to FILE')
|
||||
[CompletionResult]::new('--report-tap', 'report-tap', [CompletionResultType]::ParameterName, 'Write a TAP report to FILE')
|
||||
[CompletionResult]::new('--resolve', 'resolve', [CompletionResultType]::ParameterName, 'Provide a custom address for a specific HOST and PORT pair')
|
||||
|
@ -5,7 +5,7 @@ _hurl()
|
||||
_init_completion || return
|
||||
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=($(compgen -W '--aws-sigv4 --cacert --cert --key --color --compressed --connect-timeout --connect-to --continue-on-error --cookie --cookie-jar --delay --error-format --fail-at-end --file-root --location --location-trusted --from-entry --glob --http1.0 --http1.1 --http2 --http3 --ignore-asserts --include --insecure --interactive --ipv4 --ipv6 --jobs --json --max-filesize --max-redirs --max-time --netrc --netrc-file --netrc-optional --no-color --no-output --noproxy --output --parallel --path-as-is --proxy --report-html --report-junit --report-tap --resolve --retry --retry-interval --ssl-no-revoke --test --to-entry --unix-socket --user --user-agent --variable --variables-file --verbose --very-verbose --help --version' -- "$cur"))
|
||||
COMPREPLY=($(compgen -W '--aws-sigv4 --cacert --cert --key --color --compressed --connect-timeout --connect-to --continue-on-error --cookie --cookie-jar --delay --error-format --fail-at-end --file-root --location --location-trusted --from-entry --glob --http1.0 --http1.1 --http2 --http3 --ignore-asserts --include --insecure --interactive --ipv4 --ipv6 --jobs --json --max-filesize --max-redirs --max-time --netrc --netrc-file --netrc-optional --no-color --no-output --noproxy --output --parallel --path-as-is --proxy --report-html --report-json --report-junit --report-tap --resolve --retry --retry-interval --ssl-no-revoke --test --to-entry --unix-socket --user --user-agent --variable --variables-file --verbose --very-verbose --help --version' -- "$cur"))
|
||||
return
|
||||
fi
|
||||
|
||||
|
@ -43,6 +43,7 @@ complete -c hurl -l parallel -d '(Experimental) Run files in parallel'
|
||||
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'
|
||||
complete -c hurl -l report-json -d 'Generate JSON report to DIR'
|
||||
complete -c hurl -l report-junit -d 'Write a JUnit XML report to FILE'
|
||||
complete -c hurl -l report-tap -d 'Write a TAP report to FILE'
|
||||
complete -c hurl -l resolve -d 'Provide a custom address for a specific HOST and PORT pair'
|
||||
|
@ -192,6 +192,7 @@ will follow a redirection only for the second entry.
|
||||
| <a href="#path-as-is" id="path-as-is"><code>--path-as-is</code></a> | Tell Hurl to not handle sequences of /../ or /./ in the given URL path. Normally Hurl will squash or merge them according to standards but with this option set you tell it not to do that.<br> |
|
||||
| <a href="#proxy" id="proxy"><code>-x, --proxy <[PROTOCOL://]HOST[:PORT]></code></a> | Use the specified proxy.<br> |
|
||||
| <a href="#report-html" id="report-html"><code>--report-html <DIR></code></a> | Generate HTML report in DIR.<br><br>If the HTML report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br> |
|
||||
| <a href="#report-json" id="report-json"><code>--report-json <DIR></code></a> | Generate JSON report in DIR.<br><br>If the JSON report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br> |
|
||||
| <a href="#report-junit" id="report-junit"><code>--report-junit <FILE></code></a> | Generate JUnit File.<br><br>If the FILE report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br> |
|
||||
| <a href="#report-tap" id="report-tap"><code>--report-tap <FILE></code></a> | Generate TAP report.<br><br>If the FILE report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br> |
|
||||
| <a href="#resolve" id="resolve"><code>--resolve <HOST:PORT:ADDR></code></a> | Provide a custom address for a specific host and port pair. Using this, you can make the Hurl requests(s) use a specified address and prevent the otherwise normally resolved address to be used. Consider it a sort of /etc/hosts alternative provided on the command line.<br> |
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH hurl 1 "24 Apr 2024" "hurl 5.0.0-SNAPSHOT" " Hurl Manual"
|
||||
.TH hurl 1 "13 May 2024" "hurl 5.0.0-SNAPSHOT" " Hurl Manual"
|
||||
.SH NAME
|
||||
|
||||
hurl - run and test HTTP requests.
|
||||
@ -390,6 +390,14 @@ If the HTML report already exists, it will be updated with the new test results.
|
||||
|
||||
This is a cli-only option.
|
||||
|
||||
.IP "--report-json <DIR> "
|
||||
|
||||
Generate JSON report in DIR.
|
||||
|
||||
If the JSON report already exists, it will be updated with the new test results.
|
||||
|
||||
This is a cli-only option.
|
||||
|
||||
.IP "--report-junit <FILE> "
|
||||
|
||||
Generate JUnit File.
|
||||
|
@ -409,6 +409,14 @@ If the HTML report already exists, it will be updated with the new test results.
|
||||
|
||||
This is a cli-only option.
|
||||
|
||||
### --report-json <DIR> {#report-json}
|
||||
|
||||
Generate JSON report in DIR.
|
||||
|
||||
If the JSON report already exists, it will be updated with the new test results.
|
||||
|
||||
This is a cli-only option.
|
||||
|
||||
### --report-junit <FILE> {#report-junit}
|
||||
|
||||
Generate JUnit File.
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH hurl 1 "24 Apr 2024" "hurl 5.0.0-SNAPSHOT" " Hurl Manual"
|
||||
.TH hurl 1 "13 May 2024" "hurl 5.0.0-SNAPSHOT" " Hurl Manual"
|
||||
.SH NAME
|
||||
|
||||
hurlfmt - format Hurl files
|
||||
|
@ -81,6 +81,8 @@ The input Hurl files (HTML version) are also included and are easily accessed fr
|
||||
<img class="u-drop-shadow u-border u-max-width-100" src="/docs/assets/img/hurl-html-file.png" width="380" alt="Hurl HTML file">
|
||||
</div>
|
||||
|
||||
### JSON Report
|
||||
|
||||
### JUnit Report
|
||||
|
||||
A JUnit report can be produced by using the [`--report-junit FILE`] option.
|
||||
|
9
docs/spec/options/hurl/report_json.option
Normal file
9
docs/spec/options/hurl/report_json.option
Normal file
@ -0,0 +1,9 @@
|
||||
name: report_json
|
||||
long: report-json
|
||||
value: DIR
|
||||
help: Generate JSON report to DIR
|
||||
cli_only: true
|
||||
---
|
||||
Generate JSON report in DIR.
|
||||
|
||||
If the JSON report already exists, it will be updated with the new test results.
|
@ -97,6 +97,8 @@ Options:
|
||||
Use proxy on given PROTOCOL/HOST/PORT
|
||||
--report-html <DIR>
|
||||
Generate HTML report to DIR
|
||||
--report-json <DIR>
|
||||
Generate JSON report to DIR
|
||||
--report-junit <FILE>
|
||||
Write a JUnit XML report to FILE
|
||||
--report-tap <FILE>
|
||||
|
@ -1209,6 +1209,7 @@ will follow a redirection only for the second entry.
|
||||
| <a href="#path-as-is" id="path-as-is"><code>--path-as-is</code></a> | Tell Hurl to not handle sequences of /../ or /./ in the given URL path. Normally Hurl will squash or merge them according to standards but with this option set you tell it not to do that.<br> |
|
||||
| <a href="#proxy" id="proxy"><code>-x, --proxy <[PROTOCOL://]HOST[:PORT]></code></a> | Use the specified proxy.<br> |
|
||||
| <a href="#report-html" id="report-html"><code>--report-html <DIR></code></a> | Generate HTML report in DIR.<br><br>If the HTML report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br> |
|
||||
| <a href="#report-json" id="report-json"><code>--report-json <DIR></code></a> | Generate JSON report in DIR.<br><br>If the JSON report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br> |
|
||||
| <a href="#report-junit" id="report-junit"><code>--report-junit <FILE></code></a> | Generate JUnit File.<br><br>If the FILE report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br> |
|
||||
| <a href="#report-tap" id="report-tap"><code>--report-tap <FILE></code></a> | Generate TAP report.<br><br>If the FILE report already exists, it will be updated with the new test results.<br><br>This is a cli-only option.<br> |
|
||||
| <a href="#resolve" id="resolve"><code>--resolve <HOST:PORT:ADDR></code></a> | Provide a custom address for a specific host and port pair. Using this, you can make the Hurl requests(s) use a specified address and prevent the otherwise normally resolved address to be used. Consider it a sort of /etc/hosts alternative provided on the command line.<br> |
|
||||
|
@ -403,6 +403,14 @@ pub fn report_html() -> clap::Arg {
|
||||
.num_args(1)
|
||||
}
|
||||
|
||||
pub fn report_json() -> clap::Arg {
|
||||
clap::Arg::new("report_json")
|
||||
.long("report-json")
|
||||
.value_name("DIR")
|
||||
.help("Generate JSON report to DIR")
|
||||
.num_args(1)
|
||||
}
|
||||
|
||||
pub fn report_junit() -> clap::Arg {
|
||||
clap::Arg::new("report_junit")
|
||||
.long("report-junit")
|
||||
|
@ -254,6 +254,30 @@ pub fn jobs(arg_matches: &ArgMatches) -> Option<usize> {
|
||||
get::<u32>(arg_matches, "jobs").map(|m| m as usize)
|
||||
}
|
||||
|
||||
pub fn json_report_dir(arg_matches: &ArgMatches) -> Result<Option<PathBuf>, CliOptionsError> {
|
||||
if let Some(dir) = get::<String>(arg_matches, "report_json") {
|
||||
let path = Path::new(&dir);
|
||||
if !path.exists() {
|
||||
match std::fs::create_dir_all(path) {
|
||||
Err(_) => Err(CliOptionsError::Error(format!(
|
||||
"JSON dir {} can not be created",
|
||||
path.display()
|
||||
))),
|
||||
Ok(_) => Ok(Some(path.to_path_buf())),
|
||||
}
|
||||
} else if path.is_dir() {
|
||||
Ok(Some(path.to_path_buf()))
|
||||
} else {
|
||||
return Err(CliOptionsError::Error(format!(
|
||||
"{} is not a valid directory",
|
||||
path.display()
|
||||
)));
|
||||
}
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn netrc(arg_matches: &ArgMatches) -> bool {
|
||||
has_flag(arg_matches, "netrc")
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ pub struct CliOptions {
|
||||
pub interactive: bool,
|
||||
pub ip_resolve: Option<IpResolve>,
|
||||
pub jobs: Option<usize>,
|
||||
pub json_report_dir: Option<PathBuf>,
|
||||
pub junit_file: Option<PathBuf>,
|
||||
pub max_filesize: Option<u64>,
|
||||
pub max_redirect: Option<usize>,
|
||||
@ -206,6 +207,7 @@ pub fn parse() -> Result<CliOptions, CliOptionsError> {
|
||||
.arg(commands::path_as_is())
|
||||
.arg(commands::proxy())
|
||||
.arg(commands::report_html())
|
||||
.arg(commands::report_json())
|
||||
.arg(commands::report_junit())
|
||||
.arg(commands::report_tap())
|
||||
.arg(commands::resolve())
|
||||
@ -265,6 +267,7 @@ fn parse_matches(arg_matches: &ArgMatches) -> Result<CliOptions, CliOptionsError
|
||||
let insecure = matches::insecure(arg_matches);
|
||||
let interactive = matches::interactive(arg_matches);
|
||||
let ip_resolve = matches::ip_resolve(arg_matches);
|
||||
let json_report_dir = matches::json_report_dir(arg_matches)?;
|
||||
let junit_file = matches::junit_file(arg_matches);
|
||||
let max_filesize = matches::max_filesize(arg_matches);
|
||||
let max_redirect = matches::max_redirect(arg_matches);
|
||||
@ -319,6 +322,7 @@ fn parse_matches(arg_matches: &ArgMatches) -> Result<CliOptions, CliOptionsError
|
||||
insecure,
|
||||
interactive,
|
||||
ip_resolve,
|
||||
json_report_dir,
|
||||
junit_file,
|
||||
max_filesize,
|
||||
max_redirect,
|
||||
|
Loading…
Reference in New Issue
Block a user