api_testing_core/suite/runner/
context.rs1use std::collections::HashSet;
2use std::path::PathBuf;
3
4use nils_term::progress::Progress;
5
6use crate::suite::results::SuiteRunResults;
7use crate::suite::schema::LoadedSuite;
8
9#[derive(Debug, Clone)]
10pub struct SuiteRunOptions {
11 pub required_tags: Vec<String>,
12 pub only_ids: HashSet<String>,
13 pub skip_ids: HashSet<String>,
14 pub allow_writes_flag: bool,
15 pub fail_fast: bool,
16 pub output_dir_base: PathBuf,
17 pub env_rest_url: String,
18 pub env_gql_url: String,
19 pub env_grpc_url: String,
20 pub progress: Option<Progress>,
21}
22
23#[derive(Debug, Clone)]
24pub struct SuiteRunOutput {
25 pub run_dir_abs: PathBuf,
26 pub results: SuiteRunResults,
27}
28
29pub(super) fn suite_display_name(loaded: &LoadedSuite) -> String {
30 let name = loaded.manifest.name.trim();
31 if !name.is_empty() {
32 return name.to_string();
33 }
34 loaded
35 .suite_path
36 .file_name()
37 .and_then(|s| s.to_str())
38 .unwrap_or("suite")
39 .to_string()
40}
41
42pub(super) fn case_type_normalized(case_type_raw: &str) -> String {
43 case_type_raw.trim().to_ascii_lowercase()
44}
45
46pub(super) fn default_rest_flow_token_jq() -> String {
47 ".. | objects | (.accessToken? // .access_token? // .token? // empty) | select(type==\"string\" and length>0) | .".to_string()
48}