Skip to main content

allure_rust_commons/
model.rs

1use serde::Serialize;
2
3#[derive(Debug, Clone, Default, Serialize)]
4#[serde(rename_all = "camelCase")]
5pub struct TestResult {
6    pub uuid: String,
7    pub name: String,
8    pub full_name: Option<String>,
9    pub history_id: Option<String>,
10    pub test_case_id: Option<String>,
11    pub description: Option<String>,
12    pub description_html: Option<String>,
13    pub status: Option<Status>,
14    pub status_details: Option<StatusDetails>,
15    pub stage: Option<Stage>,
16    pub labels: Vec<Label>,
17    pub links: Vec<Link>,
18    pub parameters: Vec<Parameter>,
19    pub steps: Vec<StepResult>,
20    pub attachments: Vec<Attachment>,
21    pub title_path: Option<Vec<String>>,
22    pub start: Option<i64>,
23    pub stop: Option<i64>,
24}
25
26#[derive(Debug, Clone, Default, Serialize)]
27#[serde(rename_all = "camelCase")]
28pub struct FixtureResult {
29    pub name: String,
30    pub status: Option<Status>,
31    pub status_details: Option<StatusDetails>,
32    pub stage: Option<Stage>,
33    pub steps: Vec<StepResult>,
34    pub attachments: Vec<Attachment>,
35    pub parameters: Vec<Parameter>,
36    pub start: Option<i64>,
37    pub stop: Option<i64>,
38}
39
40#[derive(Debug, Clone, Default, Serialize)]
41#[serde(rename_all = "camelCase")]
42pub struct TestResultContainer {
43    pub uuid: String,
44    pub name: Option<String>,
45    pub children: Vec<String>,
46    pub description: Option<String>,
47    pub description_html: Option<String>,
48    pub befores: Vec<FixtureResult>,
49    pub afters: Vec<FixtureResult>,
50    pub links: Vec<Link>,
51    pub start: Option<i64>,
52    pub stop: Option<i64>,
53}
54
55#[derive(Debug, Clone, Default, Serialize)]
56#[serde(rename_all = "camelCase")]
57pub struct Globals {
58    pub attachments: Vec<GlobalAttachment>,
59    pub errors: Vec<GlobalError>,
60}
61
62#[derive(Debug, Clone, Serialize)]
63#[serde(rename_all = "camelCase")]
64pub struct GlobalAttachment {
65    pub name: String,
66    pub source: String,
67    pub content_type: String,
68}
69
70#[derive(Debug, Clone, Serialize)]
71#[serde(rename_all = "camelCase")]
72pub struct GlobalError {
73    pub message: String,
74    pub trace: Option<String>,
75}
76
77#[derive(Debug, Clone, Default, Serialize)]
78pub struct Categories(pub Vec<Category>);
79
80#[derive(Debug, Clone, Serialize)]
81#[serde(rename_all = "camelCase")]
82pub struct Category {
83    pub name: String,
84    pub description: Option<String>,
85    pub matched_statuses: Option<Vec<Status>>,
86    pub message_regex: Option<String>,
87    pub trace_regex: Option<String>,
88    pub flaky: Option<bool>,
89}
90
91#[derive(Debug, Clone, Serialize)]
92#[serde(rename_all = "lowercase")]
93pub enum Status {
94    Passed,
95    Failed,
96    Broken,
97    Skipped,
98}
99
100#[derive(Debug, Clone, Serialize)]
101#[serde(rename_all = "lowercase")]
102pub enum Stage {
103    Scheduled,
104    Running,
105    Finished,
106    Pending,
107    Interrupted,
108}
109
110#[derive(Debug, Clone, Default, Serialize)]
111#[serde(rename_all = "camelCase")]
112pub struct StatusDetails {
113    pub message: Option<String>,
114    pub trace: Option<String>,
115    pub actual: Option<String>,
116    pub expected: Option<String>,
117}
118
119#[derive(Debug, Clone, Serialize)]
120pub struct Label {
121    pub name: String,
122    pub value: String,
123}
124
125#[derive(Debug, Clone, Serialize)]
126pub struct Link {
127    pub name: Option<String>,
128    pub url: String,
129    #[serde(rename = "type")]
130    pub link_type: Option<String>,
131}
132
133#[derive(Debug, Clone, Serialize)]
134pub struct Parameter {
135    pub name: String,
136    pub value: String,
137    pub excluded: Option<bool>,
138    pub mode: Option<ParameterMode>,
139}
140
141#[derive(Debug, Clone, Serialize)]
142#[serde(rename_all = "lowercase")]
143pub enum ParameterMode {
144    Default,
145    Masked,
146    Hidden,
147}
148
149#[derive(Debug, Clone, Serialize)]
150pub struct Attachment {
151    pub name: String,
152    pub source: String,
153    #[serde(rename = "type")]
154    pub content_type: String,
155}
156
157#[derive(Debug, Clone, Default, Serialize)]
158#[serde(rename_all = "camelCase")]
159pub struct StepResult {
160    pub uuid: Option<String>,
161    pub name: String,
162    pub status: Option<Status>,
163    pub status_details: Option<StatusDetails>,
164    pub stage: Option<Stage>,
165    pub steps: Vec<StepResult>,
166    pub attachments: Vec<Attachment>,
167    pub parameters: Vec<Parameter>,
168    pub start: Option<i64>,
169    pub stop: Option<i64>,
170}