namespace TCMSDAL.DTO;
///
/// TTCMSTESTRUN — a test execution event (Cypress CI, Manual, Postman, PIE-Auto).
/// A run belongs to a project+module and produces N run-result rows.
///
public sealed class TCMSTestRunDTO
{
public int TestRunId { get; set; }
public string RunCode { get; set; } = string.Empty; // RUN-[YYYY]-[SEQ]
public string RunName { get; set; } = string.Empty;
/// FK → MTCMSPROJECT
public int ProjectId { get; set; }
public string? ProjectName { get; set; }
/// FK → MTCMSMODULE (nullable — run may span multiple modules)
public int? ModuleId { get; set; }
public string? ModuleName { get; set; }
/// Cypress | Manual | Postman | PIE-Auto
public string RunType { get; set; } = "Manual";
/// UAT | Regression | Smoke | Sanity | Integration | Performance
public string SuiteType { get; set; } = "Regression";
/// Scheduled | InProgress | Completed | Cancelled
public string Status { get; set; } = "Scheduled";
public string? LeadExecutor { get; set; }
public DateTime? ScheduledStart { get; set; }
public DateTime? ScheduledEnd { get; set; }
public DateTime? ActualStart { get; set; }
public DateTime? ActualEnd { get; set; }
// Aggregates (computed)
public int TotalCases { get; set; }
public int PassedCount { get; set; }
public int FailedCount { get; set; }
public int SkippedCount { get; set; }
public int BlockedCount { get; set; }
public decimal PassPct { get; set; }
public int TenantId { get; set; }
public int CreatedBy { get; set; }
public DateTime CreatedDate { get; set; }
public int? ModifiedBy { get; set; }
public DateTime? ModifiedDate { get; set; }
}
public sealed class TCMSTestRunListDTO
{
public int TestRunId { get; set; }
public string RunCode { get; set; } = string.Empty;
public string RunName { get; set; } = string.Empty;
public string RunType { get; set; } = string.Empty;
public string SuiteType { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public string? ProjectName { get; set; }
public string? ModuleName { get; set; }
public int TotalCases { get; set; }
public decimal PassPct { get; set; }
public DateTime? ActualStart { get; set; }
public string? LeadExecutor { get; set; }
}
///
/// TTCMSRUNRESULT — per-test-case outcome within a run.
///
public sealed class TCMSRunResultDTO
{
public int ResultId { get; set; }
/// FK → TTCMSTESTRUN
public int TestRunId { get; set; }
/// FK → MTCMSTESTCASE
public int TestCaseId { get; set; }
public string? TcId { get; set; }
public string? TestCaseTitle { get; set; }
/// Pass | Fail | Skip | Blocked | InProgress
public string Result { get; set; } = "InProgress";
public string? FailureReason { get; set; }
public string? Screenshot { get; set; } // URL/path
public string? Notes { get; set; }
public int? ExecutionMs { get; set; } // duration
public string? ExecutedBy { get; set; }
public DateTime? ExecutedAt { get; set; }
public int TenantId { get; set; }
}
/// Dashboard aggregate — pass/fail/skip trend per module.
public sealed class TCMSRunDashboardDTO
{
public string ModuleCode { get; set; } = string.Empty;
public string ModuleName { get; set; } = string.Empty;
public int TotalRuns { get; set; }
public decimal AvgPassPct { get; set; }
public int LastRunPass { get; set; }
public int LastRunFail { get; set; }
public int LastRunSkip { get; set; }
public DateTime? LastRunDate { get; set; }
}