• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2023 Google LLC
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
15syntax = "proto3";
16
17package google.devtools.resultstore.v2;
18
19import "google/devtools/resultstore/v2/common.proto";
20import "google/devtools/resultstore/v2/file.proto";
21
22option go_package = "google.golang.org/genproto/googleapis/devtools/resultstore/v2;resultstore";
23option java_multiple_files = true;
24option java_outer_classname = "TestSuiteProto";
25option java_package = "com.google.devtools.resultstore.v2";
26
27// The result of running a test suite, as reported in a <testsuite> element of
28// an XML log.
29message TestSuite {
30  // The full name of this suite, as reported in the name attribute. For Java
31  // tests, this is normally the fully qualified class name. Eg.
32  // "com.google.common.hash.BloomFilterTest".
33  string suite_name = 1;
34
35  // The results of the test cases and test suites contained in this suite,
36  // as reported in the <testcase> and <testsuite> elements contained within
37  // this <testsuite>.
38  repeated Test tests = 2;
39
40  // Failures reported in <failure> elements within this <testsuite>.
41  repeated TestFailure failures = 3;
42
43  // Errors reported in <error> elements within this <testsuite>.
44  repeated TestError errors = 4;
45
46  // The timing for the entire TestSuite, as reported by the time attribute.
47  Timing timing = 6;
48
49  // Arbitrary name-value pairs, as reported in custom attributes or in a
50  // <properties> element within this <testsuite>. Multiple properties are
51  // allowed with the same key. Properties will be returned in lexicographical
52  // order by key.
53  repeated Property properties = 7;
54
55  // Files produced by this test suite, as reported by undeclared output
56  // annotations.
57  // The file IDs must be unique within this list. Duplicate file IDs will
58  // result in an error. Files will be returned in lexicographical order by ID.
59  repeated File files = 8;
60}
61
62// The result of running a test case or test suite. JUnit3 TestDecorators are
63// represented as a TestSuite with a single test.
64message Test {
65  // Either a TestCase of a TestSuite
66  oneof test_type {
67    // When this contains just a single TestCase
68    TestCase test_case = 1;
69
70    // When this contains a TestSuite of test cases.
71    TestSuite test_suite = 2;
72  }
73}
74
75// The result of running a test case, as reported in a <testcase> element of
76// an XML log.
77message TestCase {
78  // The result of running a test case.
79  enum Result {
80    // The implicit default enum value. Do not use.
81    RESULT_UNSPECIFIED = 0;
82
83    // Test case ran to completion. Look for failures or errors to determine
84    // whether it passed, failed, or errored.
85    COMPLETED = 1;
86
87    // Test case started but did not complete because the test harness received
88    // a signal and decided to stop running tests.
89    INTERRUPTED = 2;
90
91    // Test case was not started because the test harness received a SIGINT or
92    // timed out.
93    CANCELLED = 3;
94
95    // Test case was not run because the user or process running the test
96    // specified a filter that excluded this test case.
97    FILTERED = 4;
98
99    // Test case was not run to completion because the test case decided it
100    // should not be run (eg. due to a failed assumption in a JUnit4 test).
101    // Per-test setup or tear-down may or may not have run.
102    SKIPPED = 5;
103
104    // The test framework did not run the test case because it was labeled as
105    // suppressed.  Eg. if someone temporarily disables a failing test.
106    SUPPRESSED = 6;
107  }
108
109  // The name of the test case, as reported in the name attribute. For Java,
110  // this is normally the method name. Eg. "testBasic".
111  string case_name = 1;
112
113  // The name of the class in which the test case was defined, as reported in
114  // the classname attribute. For Java, this is normally the fully qualified
115  // class name. Eg. "com.google.common.hash.BloomFilterTest".
116  string class_name = 2;
117
118  // An enum reported in the result attribute that is used in conjunction with
119  // failures and errors below to report the outcome.
120  Result result = 3;
121
122  // Failures reported in <failure> elements within this <testcase>.
123  repeated TestFailure failures = 4;
124
125  // Errors reported in <error> elements within this <testcase>.
126  repeated TestError errors = 5;
127
128  // The timing for the TestCase, as reported by the time attribute.
129  Timing timing = 7;
130
131  // Arbitrary name-value pairs, as reported in custom attributes or in a
132  // <properties> element within this <testcase>. Multiple properties are
133  // allowed with the same key. Properties will be returned in lexicographical
134  // order by key.
135  repeated Property properties = 8;
136
137  // Files produced by this test case, as reported by undeclared output
138  // annotations.
139  // The file IDs must be unique within this list. Duplicate file IDs will
140  // result in an error. Files will be returned in lexicographical order by ID.
141  repeated File files = 9;
142
143  // The 0-indexed retry number of the test case. A value of `0` may indicate
144  // either that this is the first in a series of retries, or that no retries
145  // were requested.
146  int32 retry_number = 10;
147
148  // The 0-indexed repeat number of the test case. A value of `0` may indicate
149  // either that this is the first in a series of repeats, or that no repeats
150  // were requested.
151  int32 repeat_number = 11;
152}
153
154// Represents a violated assertion, as reported in a <failure> element within a
155// <testcase>. Some languages allow assertions to be made without stopping the
156// test case when they're violated, leading to multiple TestFailures. For Java,
157// multiple TestFailures are used to represent a chained exception.
158message TestFailure {
159  // The exception message reported in the message attribute. Typically short,
160  // but may be multi-line. Eg. "Expected 'foo' but was 'bar'".
161  string failure_message = 1;
162
163  // The type of the exception being thrown, reported in the type attribute.
164  // Eg: "org.junit.ComparisonFailure"
165  string exception_type = 2;
166
167  // The stack trace reported as the content of the <failure> element, often in
168  // a CDATA block. This contains one line for each stack frame, each including
169  // a method/function name, a class/file name, and a line number. Most recent
170  // call is usually first, but not for Python stack traces. May contain the
171  // exception_type and message.
172  string stack_trace = 3;
173
174  // The expected values.
175  //
176  // These values can be diffed against the actual values. Often, there is just
177  // one actual and one expected value. If there is more than one, they should
178  // be compared as an unordered collection.
179  repeated string expected = 4;
180
181  // The actual values.
182  //
183  // These values can be diffed against the expected values. Often, there is
184  // just one actual and one expected value. If there is more than one, they
185  // should be compared as an unordered collection.
186  repeated string actual = 5;
187}
188
189// Represents an exception that prevented a test case from completing, as
190// reported in an <error> element within a <testcase>. For Java, multiple
191// TestErrors are used to represent a chained exception.
192message TestError {
193  // The exception message, as reported in the message attribute. Typically
194  // short, but may be multi-line. Eg. "argument cannot be null".
195  string error_message = 1;
196
197  // The type of the exception being thrown, reported in the type attribute.
198  // For Java, this is a fully qualified Throwable class name.
199  // Eg: "java.lang.IllegalArgumentException"
200  string exception_type = 2;
201
202  // The stack trace reported as the content of the <error> element, often in
203  // a CDATA block. This contains one line for each stack frame, each including
204  // a method/function name, a class/file name, and a line number. Most recent
205  // call is usually first, but not for Python stack traces. May contain the
206  // exception_type and message.
207  string stack_trace = 3;
208}
209