-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add XUnit Formatting Output to Scorecard (#5048)
- Loading branch information
Ish Shah
authored
Jul 16, 2021
1 parent
fb2a657
commit 570cae3
Showing
5 changed files
with
136 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# entries is a list of entries to include in | ||
# release notes and/or the migration guide | ||
entries: | ||
- description: > | ||
Provide XML formatting option for scorecard users. Additionally transforms scorecard result types to xunit testsuite/testcase layout. | ||
# kind is one of: | ||
# - addition | ||
# - change | ||
# - deprecation | ||
# - removal | ||
# - bugfix | ||
kind: "addition" | ||
# Is this a breaking change? | ||
breaking: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Copyright 2020 The Operator-SDK Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package xunitapi | ||
|
||
// TestCase contain the core information from a test run, including its name and status | ||
type TestCase struct { | ||
// Name is the name of the test | ||
Name string `json:"name,omitempty"` | ||
Time string `json:"time,omitempty"` | ||
Classname string `json:"classname,omitempty"` | ||
Group string `json:"group,omitempty"` | ||
Failures []XUnitComplexFailure `json:"failure,omitempty"` | ||
Errors []XUnitComplexError `json:"error,omitempty"` | ||
Skipped []XUnitComplexSkipped `json:"skipped,omitempty"` | ||
} | ||
|
||
// TestSuite contains for details about a test beyond the final status | ||
type TestSuite struct { | ||
// Name is the name of the test | ||
Name string `json:"name,omitempty"` | ||
Tests string `json:"tests,omitempty"` | ||
Failures string `json:"failures,omitempty"` | ||
Errors string `json:"errors,omitempty"` | ||
Group string `json:"group,omitempty"` | ||
Skipped string `json:"skipped,omitempty"` | ||
Timestamp string `json:"timestamp,omitempty"` | ||
Hostname string `json:"hostnames,omitempty"` | ||
ID string `json:"id,omitempty"` | ||
Package string `json:"package,omitempty"` | ||
File string `json:"file,omitempty"` | ||
Log string `json:"log,omitempty"` | ||
URL string `json:"url,omitempty"` | ||
Version string `json:"version,omitempty"` | ||
TestSuites []TestSuite `json:"testsuite,omitempty"` | ||
TestCases []TestCase `json:"testcase,omitempty"` | ||
} | ||
|
||
// TestSuites is the top level object for amassing Xunit test results | ||
type TestSuites struct { | ||
// Name is the name of the test | ||
Name string `json:"name,omitempty"` | ||
Tests string `json:"tests,omitempty"` | ||
Failures string `json:"failures,omitempty"` | ||
Errors string `json:"errors,omitempty"` | ||
TestSuite []TestSuite `json:"testsuite,omitempty"` | ||
} | ||
|
||
// XUnitComplexError contains a type header along with the error messages | ||
type XUnitComplexError struct { | ||
Type string `json:"type,omitempty"` | ||
Message string `json:"message,omitempty"` | ||
} | ||
|
||
// XUnitComplexFailure contains a type header along with the failure logs | ||
type XUnitComplexFailure struct { | ||
Type string `json:"type,omitempty"` | ||
Message string `json:"message,omitempty"` | ||
} | ||
|
||
// XUnitComplexSkipped contains a type header along with associated run logs | ||
type XUnitComplexSkipped struct { | ||
Type string `json:"type,omitempty"` | ||
Message string `json:"message,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters