allure_rust_core/
models.rs1use serde::Serialize;
2use uuid::Uuid;
3
4#[derive(Serialize, Debug, Clone)]
5#[serde(rename_all = "camelCase")]
6pub enum Status {
7 Passed,
8 Failed,
9 Broken,
10 Skipped,
11}
12
13#[derive(Serialize, Debug, Default, Clone)]
14#[serde(rename_all = "camelCase")]
15pub struct StatusDetails {
16 #[serde(skip_serializing_if = "Option::is_none")]
17 pub message: Option<String>,
18 #[serde(skip_serializing_if = "Option::is_none")]
19 pub trace: Option<String>,
20}
21
22#[derive(Serialize, Debug, Clone)]
23#[serde(rename_all = "camelCase")]
24pub struct Attachment {
25 pub name: String,
26 pub source: String, #[serde(rename = "type")]
28 pub attachment_type: String,
29}
30
31#[derive(Serialize, Debug, Clone)]
32#[serde(rename_all = "camelCase")]
33pub struct TestStep {
34 pub name: String,
35 pub status: Status,
36 #[serde(skip_serializing_if = "Option::is_none")]
37 pub status_details: Option<StatusDetails>,
38 pub stage: String,
39 pub start: i64,
40 pub stop: i64,
41 #[serde(default)]
42 pub steps: Vec<TestStep>,
43 #[serde(default)]
44 pub attachments: Vec<Attachment>,
45 #[serde(default)]
46 pub parameters: Vec<Parameter>,
47}
48
49#[derive(Serialize, Debug, Clone)]
50pub struct Parameter {
51 pub name: String,
52 pub value: String,
53}
54
55#[derive(Serialize, Debug)]
56#[serde(rename_all = "camelCase")]
57pub struct TestResult {
58 #[serde(default = "Uuid::new_v4")]
59 pub uuid: Uuid,
60 #[serde(default = "Uuid::new_v4")]
61 pub history_id: Uuid,
62 pub name: String,
63 #[serde(skip_serializing_if = "Option::is_none")]
64 pub description: Option<String>,
65 pub status: Status,
66 #[serde(skip_serializing_if = "Option::is_none")]
67 pub status_details: Option<StatusDetails>,
68 pub stage: String,
69 pub start: i64,
70 pub stop: i64,
71 #[serde(default)]
72 pub labels: Vec<Label>,
73 #[serde(default)]
74 pub parameters: Vec<Parameter>,
75 #[serde(default)]
76 pub links: Vec<Link>,
77 #[serde(default)]
78 pub steps: Vec<TestStep>,
79 #[serde(default)]
80 pub attachments: Vec<Attachment>,
81}
82
83#[derive(Serialize, Debug, Clone)]
84pub struct Label {
85 pub name: String,
86 pub value: String,
87}
88
89#[derive(Serialize, Debug, Clone)]
90pub struct Link {
91 pub name: String,
92 pub url: String,
93 #[serde(rename = "type")]
94 pub link_type: String,
95}