|
| 1 | +// Copyright 2020 The Operator-SDK Authors |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +package xunitapi |
| 16 | + |
| 17 | +// TestCase contain the core information from a test run, including its name and status |
| 18 | +type TestCase struct { |
| 19 | + // Name is the name of the test |
| 20 | + Name string `json:"name,omitempty"` |
| 21 | + Time string `json:"time,omitempty"` |
| 22 | + Classname string `json:"classname,omitempty"` |
| 23 | + Group string `json:"group,omitempty"` |
| 24 | + Failures []XUnitComplexFailure `json:"failure,omitempty"` |
| 25 | + Errors []XUnitComplexError `json:"error,omitempty"` |
| 26 | + Skipped []XUnitComplexSkipped `json:"skipped,omitempty"` |
| 27 | +} |
| 28 | + |
| 29 | +// TestSuite contains for details about a test beyond the final status |
| 30 | +type TestSuite struct { |
| 31 | + // Name is the name of the test |
| 32 | + Name string `json:"name,omitempty"` |
| 33 | + Tests string `json:"tests,omitempty"` |
| 34 | + Failures string `json:"failures,omitempty"` |
| 35 | + Errors string `json:"errors,omitempty"` |
| 36 | + Group string `json:"group,omitempty"` |
| 37 | + Skipped string `json:"skipped,omitempty"` |
| 38 | + Timestamp string `json:"timestamp,omitempty"` |
| 39 | + Hostname string `json:"hostnames,omitempty"` |
| 40 | + ID string `json:"id,omitempty"` |
| 41 | + Package string `json:"package,omitempty"` |
| 42 | + File string `json:"file,omitempty"` |
| 43 | + Log string `json:"log,omitempty"` |
| 44 | + URL string `json:"url,omitempty"` |
| 45 | + Version string `json:"version,omitempty"` |
| 46 | + TestSuites []TestSuite `json:"testsuite,omitempty"` |
| 47 | + TestCases []TestCase `json:"testcase,omitempty"` |
| 48 | +} |
| 49 | + |
| 50 | +// TestSuites is the top level object for amassing Xunit test results |
| 51 | +type TestSuites struct { |
| 52 | + // Name is the name of the test |
| 53 | + Name string `json:"name,omitempty"` |
| 54 | + Tests string `json:"tests,omitempty"` |
| 55 | + Failures string `json:"failures,omitempty"` |
| 56 | + Errors string `json:"errors,omitempty"` |
| 57 | + TestSuite []TestSuite `json:"testsuite,omitempty"` |
| 58 | +} |
| 59 | + |
| 60 | +// XUnitComplexError contains a type header along with the error messages |
| 61 | +type XUnitComplexError struct { |
| 62 | + Type string `json:"type,omitempty"` |
| 63 | + Message string `json:"message,omitempty"` |
| 64 | +} |
| 65 | + |
| 66 | +// XUnitComplexFailure contains a type header along with the failure logs |
| 67 | +type XUnitComplexFailure struct { |
| 68 | + Type string `json:"type,omitempty"` |
| 69 | + Message string `json:"message,omitempty"` |
| 70 | +} |
| 71 | + |
| 72 | +// XUnitComplexSkipped contains a type header along with associated run logs |
| 73 | +type XUnitComplexSkipped struct { |
| 74 | + Type string `json:"type,omitempty"` |
| 75 | + Message string `json:"message,omitempty"` |
| 76 | +} |
0 commit comments