1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//! Test reporting and summary models for workflow execution.
use serde::{Deserialize, Serialize};
use uuid::Uuid;
/// Details of a single test report associated with a step instance.
#[derive(Debug, Serialize, Deserialize, Clone, sqlx::FromRow)]
pub struct TestReport {
/// Unique identifier for the test report.
pub id: Uuid,
/// Associated workflow run ID.
pub run_id: Uuid,
/// Associated step instance ID.
pub step_instance_id: Uuid,
/// Logical name of the report.
pub report_name: String,
/// Original file name of the report.
pub file_name: String,
/// Format of the report (e.g., 'junit', 'clover').
pub format: String,
/// Raw content of the report, if small enough to be inlined.
pub content: Option<String>,
/// Storage backend ID where the full report is stored.
pub backend_id: Option<Uuid>,
/// Path to the report in the remote storage backend.
pub remote_path: Option<String>,
/// Checksum of the report content.
pub checksum: String,
/// Timestamp when the report was recorded.
pub created_at: chrono::DateTime<chrono::Utc>,
}
/// Aggregated summary of test results for a specific report.
#[derive(Debug, Serialize, Deserialize, Clone, sqlx::FromRow, Default)]
pub struct TestSummary {
/// Unique identifier for the summary.
pub id: Uuid,
/// Associated workflow run ID.
pub run_id: Uuid,
/// Associated step instance ID.
pub step_instance_id: Uuid,
/// Logical name of the report.
pub report_name: String,
/// Total number of tests executed.
pub total_tests: i32,
/// Number of tests that passed.
pub passed: i32,
/// Number of tests that failed.
pub failed: i32,
/// Number of tests that were skipped.
pub skipped: i32,
/// Number of tests that encountered an error.
pub errors: i32,
/// Total duration of the test suite execution in milliseconds.
pub duration_ms: i64,
/// Timestamp when the summary was generated.
pub created_at: chrono::DateTime<chrono::Utc>,
}
/// Status of an individual test case.
#[derive(Debug, Serialize, Deserialize, Clone, sqlx::Type, PartialEq, Eq)]
#[sqlx(type_name = "test_case_status", rename_all = "snake_case")]
#[serde(rename_all = "snake_case")]
pub enum TestCaseStatus {
/// The test case passed successfully.
Passed,
/// The test case failed.
Failed,
/// The test case was skipped.
Skipped,
/// The test case encountered an unexpected error.
Error,
}
/// Details of an individual test case execution.
#[derive(Debug, Serialize, Deserialize, Clone, sqlx::FromRow)]
pub struct TestCase {
/// Unique identifier for the test case record.
pub id: Uuid,
/// Associated workflow run ID.
pub run_id: Uuid,
/// Associated step instance ID.
pub step_instance_id: Uuid,
/// Logical name of the report containing this test case.
pub report_name: String,
/// Name of the test suite this case belongs to.
pub test_suite: Option<String>,
/// Name of the test case.
pub test_case: String,
/// Final status of the test case execution.
pub status: TestCaseStatus,
/// Duration of the test case execution in milliseconds.
pub duration_ms: Option<i64>,
/// Optional error or failure message associated with the test case.
pub message: Option<String>,
/// Timestamp when the test case record was created.
pub created_at: chrono::DateTime<chrono::Utc>,
}