Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: SystemOutput in the PipelineTestCase #1697

Merged
merged 4 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion pipelines.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,18 @@ type PipelineTestCases struct {
Classname string `json:"classname"`
File string `json:"file"`
ExecutionTime float64 `json:"execution_time"`
SystemOutput string `json:"system_output"`
SystemOutput SystemOutput `json:"system_output"`
StackTrace string `json:"stack_trace"`
AttachmentURL string `json:"attachment_url"`
RecentFailures RecentFailures `json:"recent_failures"`
}

// SystemOutput contains information about test cases when it fails
GaikwadPratik marked this conversation as resolved.
Show resolved Hide resolved
type SystemOutput struct {
GaikwadPratik marked this conversation as resolved.
Show resolved Hide resolved
Type string `json:"type"`
Message string `json:"message"`
}

// RecentFailures contains failures count for the project's default branch.
type RecentFailures struct {
Count int `json:"count"`
Expand Down
16 changes: 11 additions & 5 deletions pipelines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ func TestGetPipelineTestReport(t *testing.T) {
Classname: "MyClassOne",
File: "/path/file.ext",
ExecutionTime: 19.987,
SystemOutput: "output message\n\noutput message 2",
SystemOutput: SystemOutput{
Type: "failure",
Message: "Failed test",
},
StackTrace: "java.lang.Exception: Stack trace\nat java.base/java.lang.Thread.dumpStack(Thread.java:1383)",
AttachmentURL: "http://foo.bar",
RecentFailures: RecentFailures{
Expand All @@ -133,7 +136,7 @@ func TestGetPipelineTestReport(t *testing.T) {
Classname: "MyClass",
File: "",
ExecutionTime: 19.984,
SystemOutput: "",
SystemOutput: SystemOutput{},
StackTrace: "",
AttachmentURL: "",
RecentFailures: RecentFailures{},
Expand All @@ -144,7 +147,10 @@ func TestGetPipelineTestReport(t *testing.T) {
Classname: "MyClass",
File: "",
ExecutionTime: 0.0,
SystemOutput: "Undefined message",
SystemOutput: SystemOutput{
Type: "failed",
Message: "Failed test",
},
StackTrace: "",
AttachmentURL: "",
},
Expand All @@ -154,7 +160,7 @@ func TestGetPipelineTestReport(t *testing.T) {
Classname: "MyClass",
File: "",
ExecutionTime: 19.7799999999999985,
SystemOutput: "",
SystemOutput: SystemOutput{},
StackTrace: "",
AttachmentURL: "",
},
Expand All @@ -174,7 +180,7 @@ func TestGetPipelineTestReport(t *testing.T) {
Classname: "MyClass",
File: "",
ExecutionTime: 1.008,
SystemOutput: "",
SystemOutput: SystemOutput{},
StackTrace: "",
AttachmentURL: "",
}},
Expand Down
10 changes: 8 additions & 2 deletions testdata/get_pipeline_testreport.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
"classname": "MyClassOne",
"file": "/path/file.ext",
"execution_time": 19.987,
"system_output": "output message\n\noutput message 2",
"system_output": {
"type": "failure",
"message": "Failed test"
},
"stack_trace": "java.lang.Exception: Stack trace\nat java.base/java.lang.Thread.dumpStack(Thread.java:1383)",
"attachment_url": "http://foo.bar",
"recent_failures": {
Expand All @@ -47,7 +50,10 @@
"classname": "MyClass",
"file": null,
"execution_time": 0.0,
"system_output": "Undefined message"
"system_output": {
"type": "failure",
"message": "Failed test"
}
},
{
"status": "success",
Expand Down