-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add XUnit Formatting Output to Scorecard #5048
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
Merged
theishshah
merged 18 commits into
operator-framework:master
from
theishshah:xunit-formatting
Jul 16, 2021
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
a85492c
add xml export to cmd, todo convert type before export
0609cc9
flip error
e82b97a
unwrap json element
270aadb
update doc and struct
94bd69e
new complex type implementation
1848b2d
handle fail and error case;
50fbb2c
add error handling in command line
4470124
comment out new api field
2081221
added potential timestamping to scorecard, needs api change
ee94a41
add changelog fragment
5cb8390
fix typos
3d3e0c9
removed duplicate flag gate
33a480f
fix sanity;
5d2d302
Add todo comments and remove extra error
5c35b11
Xunit comments and seperate package
b7b09e0
spelling nit
6780b94
link structs to parent result, push before update/reboot to test
0ea1eb2
duplicate case data in xunit suite;
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could've just done: