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.cloud.dialogflow.cx.v3;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/cloud/dialogflow/cx/v3/flow.proto";
24import "google/cloud/dialogflow/cx/v3/intent.proto";
25import "google/cloud/dialogflow/cx/v3/page.proto";
26import "google/cloud/dialogflow/cx/v3/response_message.proto";
27import "google/cloud/dialogflow/cx/v3/session.proto";
28import "google/cloud/dialogflow/cx/v3/transition_route_group.proto";
29import "google/longrunning/operations.proto";
30import "google/protobuf/empty.proto";
31import "google/protobuf/field_mask.proto";
32import "google/protobuf/struct.proto";
33import "google/protobuf/timestamp.proto";
34import "google/rpc/status.proto";
35
36option cc_enable_arenas = true;
37option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3";
38option go_package = "cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpb";
39option java_multiple_files = true;
40option java_outer_classname = "TestCaseProto";
41option java_package = "com.google.cloud.dialogflow.cx.v3";
42option objc_class_prefix = "DF";
43option ruby_package = "Google::Cloud::Dialogflow::CX::V3";
44
45// Service for managing [Test Cases][google.cloud.dialogflow.cx.v3.TestCase] and
46// [Test Case Results][google.cloud.dialogflow.cx.v3.TestCaseResult].
47service TestCases {
48  option (google.api.default_host) = "dialogflow.googleapis.com";
49  option (google.api.oauth_scopes) =
50      "https://www.googleapis.com/auth/cloud-platform,"
51      "https://www.googleapis.com/auth/dialogflow";
52
53  // Fetches a list of test cases for a given agent.
54  rpc ListTestCases(ListTestCasesRequest) returns (ListTestCasesResponse) {
55    option (google.api.http) = {
56      get: "/v3/{parent=projects/*/locations/*/agents/*}/testCases"
57    };
58    option (google.api.method_signature) = "parent";
59  }
60
61  // Batch deletes test cases.
62  rpc BatchDeleteTestCases(BatchDeleteTestCasesRequest)
63      returns (google.protobuf.Empty) {
64    option (google.api.http) = {
65      post: "/v3/{parent=projects/*/locations/*/agents/*}/testCases:batchDelete"
66      body: "*"
67    };
68    option (google.api.method_signature) = "parent";
69  }
70
71  // Gets a test case.
72  rpc GetTestCase(GetTestCaseRequest) returns (TestCase) {
73    option (google.api.http) = {
74      get: "/v3/{name=projects/*/locations/*/agents/*/testCases/*}"
75    };
76    option (google.api.method_signature) = "name";
77  }
78
79  // Creates a test case for the given agent.
80  rpc CreateTestCase(CreateTestCaseRequest) returns (TestCase) {
81    option (google.api.http) = {
82      post: "/v3/{parent=projects/*/locations/*/agents/*}/testCases"
83      body: "test_case"
84    };
85    option (google.api.method_signature) = "parent,test_case";
86  }
87
88  // Updates the specified test case.
89  rpc UpdateTestCase(UpdateTestCaseRequest) returns (TestCase) {
90    option (google.api.http) = {
91      patch: "/v3/{test_case.name=projects/*/locations/*/agents/*/testCases/*}"
92      body: "test_case"
93    };
94    option (google.api.method_signature) = "test_case,update_mask";
95  }
96
97  // Kicks off a test case run.
98  //
99  // This method is a [long-running
100  // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
101  // The returned `Operation` type has the following method-specific fields:
102  //
103  // - `metadata`:
104  // [RunTestCaseMetadata][google.cloud.dialogflow.cx.v3.RunTestCaseMetadata]
105  // - `response`:
106  // [RunTestCaseResponse][google.cloud.dialogflow.cx.v3.RunTestCaseResponse]
107  rpc RunTestCase(RunTestCaseRequest) returns (google.longrunning.Operation) {
108    option (google.api.http) = {
109      post: "/v3/{name=projects/*/locations/*/agents/*/testCases/*}:run"
110      body: "*"
111    };
112    option (google.longrunning.operation_info) = {
113      response_type: "RunTestCaseResponse"
114      metadata_type: "RunTestCaseMetadata"
115    };
116  }
117
118  // Kicks off a batch run of test cases.
119  //
120  // This method is a [long-running
121  // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
122  // The returned `Operation` type has the following method-specific fields:
123  //
124  // - `metadata`:
125  // [BatchRunTestCasesMetadata][google.cloud.dialogflow.cx.v3.BatchRunTestCasesMetadata]
126  // - `response`:
127  // [BatchRunTestCasesResponse][google.cloud.dialogflow.cx.v3.BatchRunTestCasesResponse]
128  rpc BatchRunTestCases(BatchRunTestCasesRequest)
129      returns (google.longrunning.Operation) {
130    option (google.api.http) = {
131      post: "/v3/{parent=projects/*/locations/*/agents/*}/testCases:batchRun"
132      body: "*"
133    };
134    option (google.longrunning.operation_info) = {
135      response_type: "BatchRunTestCasesResponse"
136      metadata_type: "BatchRunTestCasesMetadata"
137    };
138  }
139
140  // Calculates the test coverage for an agent.
141  rpc CalculateCoverage(CalculateCoverageRequest)
142      returns (CalculateCoverageResponse) {
143    option (google.api.http) = {
144      get: "/v3/{agent=projects/*/locations/*/agents/*}/testCases:calculateCoverage"
145    };
146  }
147
148  // Imports the test cases from a Cloud Storage bucket or a local file. It
149  // always creates new test cases and won't overwrite any existing ones. The
150  // provided ID in the imported test case is neglected.
151  //
152  // This method is a [long-running
153  // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
154  // The returned `Operation` type has the following method-specific fields:
155  //
156  // - `metadata`:
157  // [ImportTestCasesMetadata][google.cloud.dialogflow.cx.v3.ImportTestCasesMetadata]
158  // - `response`:
159  // [ImportTestCasesResponse][google.cloud.dialogflow.cx.v3.ImportTestCasesResponse]
160  rpc ImportTestCases(ImportTestCasesRequest)
161      returns (google.longrunning.Operation) {
162    option (google.api.http) = {
163      post: "/v3/{parent=projects/*/locations/*/agents/*}/testCases:import"
164      body: "*"
165    };
166    option (google.longrunning.operation_info) = {
167      response_type: "ImportTestCasesResponse"
168      metadata_type: "ImportTestCasesMetadata"
169    };
170  }
171
172  // Exports the test cases under the agent to a Cloud Storage bucket or a local
173  // file. Filter can be applied to export a subset of test cases.
174  //
175  // This method is a [long-running
176  // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
177  // The returned `Operation` type has the following method-specific fields:
178  //
179  // - `metadata`:
180  // [ExportTestCasesMetadata][google.cloud.dialogflow.cx.v3.ExportTestCasesMetadata]
181  // - `response`:
182  // [ExportTestCasesResponse][google.cloud.dialogflow.cx.v3.ExportTestCasesResponse]
183  rpc ExportTestCases(ExportTestCasesRequest)
184      returns (google.longrunning.Operation) {
185    option (google.api.http) = {
186      post: "/v3/{parent=projects/*/locations/*/agents/*}/testCases:export"
187      body: "*"
188    };
189    option (google.longrunning.operation_info) = {
190      response_type: "ExportTestCasesResponse"
191      metadata_type: "ExportTestCasesMetadata"
192    };
193  }
194
195  // Fetches a list of results for a given test case.
196  rpc ListTestCaseResults(ListTestCaseResultsRequest)
197      returns (ListTestCaseResultsResponse) {
198    option (google.api.http) = {
199      get: "/v3/{parent=projects/*/locations/*/agents/*/testCases/*}/results"
200    };
201    option (google.api.method_signature) = "parent";
202  }
203
204  // Gets a test case result.
205  rpc GetTestCaseResult(GetTestCaseResultRequest) returns (TestCaseResult) {
206    option (google.api.http) = {
207      get: "/v3/{name=projects/*/locations/*/agents/*/testCases/*/results/*}"
208    };
209    option (google.api.method_signature) = "name";
210  }
211}
212
213// Represents a test case.
214message TestCase {
215  option (google.api.resource) = {
216    type: "dialogflow.googleapis.com/TestCase"
217    pattern: "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}"
218  };
219
220  // The unique identifier of the test case.
221  // [TestCases.CreateTestCase][google.cloud.dialogflow.cx.v3.TestCases.CreateTestCase]
222  // will populate the name automatically. Otherwise use format:
223  // `projects/<Project ID>/locations/<LocationID>/agents/
224  // <AgentID>/testCases/<TestCase ID>`.
225  string name = 1;
226
227  // Tags are short descriptions that users may apply to test cases for
228  // organizational and filtering purposes. Each tag should start with "#" and
229  // has a limit of 30 characters.
230  repeated string tags = 2;
231
232  // Required. The human-readable name of the test case, unique within the
233  // agent. Limit of 200 characters.
234  string display_name = 3 [(google.api.field_behavior) = REQUIRED];
235
236  // Additional freeform notes about the test case. Limit of 400 characters.
237  string notes = 4;
238
239  // Config for the test case.
240  TestConfig test_config = 13;
241
242  // The conversation turns uttered when the test case was created, in
243  // chronological order. These include the canonical set of agent utterances
244  // that should occur when the agent is working properly.
245  repeated ConversationTurn test_case_conversation_turns = 5;
246
247  // Output only. When the test was created.
248  google.protobuf.Timestamp creation_time = 10
249      [(google.api.field_behavior) = OUTPUT_ONLY];
250
251  // The latest test result.
252  TestCaseResult last_test_result = 12;
253}
254
255// Represents a result from running a test case in an agent environment.
256message TestCaseResult {
257  option (google.api.resource) = {
258    type: "dialogflow.googleapis.com/TestCaseResult"
259    pattern: "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}/results/{result}"
260  };
261
262  // The resource name for the test case result. Format:
263  // `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/testCases/
264  // <TestCase ID>/results/<TestCaseResult ID>`.
265  string name = 1;
266
267  // Environment where the test was run. If not set, it indicates the draft
268  // environment.
269  string environment = 2 [(google.api.resource_reference) = {
270    type: "dialogflow.googleapis.com/Environment"
271  }];
272
273  // The conversation turns uttered during the test case replay in chronological
274  // order.
275  repeated ConversationTurn conversation_turns = 3;
276
277  // Whether the test case passed in the agent environment.
278  TestResult test_result = 4;
279
280  // The time that the test was run.
281  google.protobuf.Timestamp test_time = 5;
282}
283
284// Represents configurations for a test case.
285message TestConfig {
286  // Session parameters to be compared when calculating differences.
287  repeated string tracking_parameters = 1;
288
289  // Flow name to start the test case with.
290  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
291  // ID>/flows/<Flow ID>`.
292  //
293  // Only one of `flow` and `page` should be set to indicate the starting point
294  // of the test case. If both are set, `page` takes precedence over `flow`. If
295  // neither is set, the test case will start with start page on the default
296  // start flow.
297  string flow = 2 [
298    (google.api.resource_reference) = { type: "dialogflow.googleapis.com/Flow" }
299  ];
300
301  // The [page][google.cloud.dialogflow.cx.v3.Page] to start the test case with.
302  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
303  // ID>/flows/<Flow ID>/pages/<Page ID>`.
304  //
305  // Only one of `flow` and `page` should be set to indicate the starting point
306  // of the test case. If both are set, `page` takes precedence over `flow`. If
307  // neither is set, the test case will start with start page on the default
308  // start flow.
309  string page = 3 [
310    (google.api.resource_reference) = { type: "dialogflow.googleapis.com/Page" }
311  ];
312}
313
314// One interaction between a human and virtual agent. The human provides some
315// input and the virtual agent provides a response.
316message ConversationTurn {
317  // The input from the human user.
318  message UserInput {
319    // Supports [text input][google.cloud.dialogflow.cx.v3.QueryInput.text],
320    // [event input][google.cloud.dialogflow.cx.v3.QueryInput.event], [dtmf
321    // input][google.cloud.dialogflow.cx.v3.QueryInput.dtmf] in the test case.
322    QueryInput input = 5;
323
324    // Parameters that need to be injected into the conversation during intent
325    // detection.
326    google.protobuf.Struct injected_parameters = 2;
327
328    // If webhooks should be allowed to trigger in response to the user
329    // utterance. Often if parameters are injected, webhooks should not be
330    // enabled.
331    bool is_webhook_enabled = 3;
332
333    // Whether sentiment analysis is enabled.
334    bool enable_sentiment_analysis = 7;
335  }
336
337  // The output from the virtual agent.
338  message VirtualAgentOutput {
339    // The session parameters available to the bot at this point.
340    google.protobuf.Struct session_parameters = 4;
341
342    // Output only. If this is part of a [result conversation
343    // turn][TestCaseResult.conversation_turns], the list of differences
344    // between the original run and the replay for this output, if any.
345    repeated TestRunDifference differences = 5
346        [(google.api.field_behavior) = OUTPUT_ONLY];
347
348    // Required. Input only. The diagnostic
349    // [info][Session.DetectIntentResponse.QueryResult.diagnostic_info]
350    // output for the turn. Required to calculate the testing coverage.
351    google.protobuf.Struct diagnostic_info = 6 [
352      (google.api.field_behavior) = REQUIRED,
353      (google.api.field_behavior) = INPUT_ONLY
354    ];
355
356    // The [Intent][google.cloud.dialogflow.cx.v3.Intent] that triggered the
357    // response. Only name and displayName will be set.
358    Intent triggered_intent = 7;
359
360    // The [Page][google.cloud.dialogflow.cx.v3.Page] on which the utterance was
361    // spoken. Only name and displayName will be set.
362    Page current_page = 8;
363
364    // The [text][google.cloud.dialogflow.cx.v3.ResponseMessage.Text] responses
365    // from the agent for the turn.
366    repeated ResponseMessage.Text text_responses = 9;
367
368    // Response error from the agent in the test result. If set, other output
369    // is empty.
370    google.rpc.Status status = 10;
371  }
372
373  // The user input.
374  UserInput user_input = 1;
375
376  // The virtual agent output.
377  VirtualAgentOutput virtual_agent_output = 2;
378}
379
380// The description of differences between original and replayed agent output.
381message TestRunDifference {
382  // What part of the message replay differs from the test case.
383  enum DiffType {
384    // Should never be used.
385    DIFF_TYPE_UNSPECIFIED = 0;
386
387    // The intent.
388    INTENT = 1;
389
390    // The page.
391    PAGE = 2;
392
393    // The parameters.
394    PARAMETERS = 3;
395
396    // The message utterance.
397    UTTERANCE = 4;
398
399    // The flow.
400    FLOW = 5;
401  }
402
403  // The type of diff.
404  DiffType type = 1;
405
406  // A description of the diff, showing the actual output vs expected output.
407  string description = 2;
408}
409
410// Transition coverage represents the percentage of all possible page
411// transitions (page-level transition routes and event handlers, excluding
412// transition route groups) present within any of a parent's test cases.
413message TransitionCoverage {
414  // The source or target of a transition.
415  message TransitionNode {
416    // A TransitionNode can be either a page or a flow.
417    oneof kind {
418      // Indicates a transition to a [Page][google.cloud.dialogflow.cx.v3.Page].
419      // Only some fields such as name and displayname will be set.
420      Page page = 1;
421
422      // Indicates a transition to a [Flow][google.cloud.dialogflow.cx.v3.Flow].
423      // Only some fields such as name and displayname will be set.
424      Flow flow = 2;
425    }
426  }
427
428  // A transition in a page.
429  message Transition {
430    // The start node of a transition.
431    TransitionNode source = 1;
432
433    // The index of a transition in the transition list. Starting from 0.
434    int32 index = 4;
435
436    // The end node of a transition.
437    TransitionNode target = 2;
438
439    // Whether the transition is covered by at least one of the
440    // agent's test cases.
441    bool covered = 3;
442
443    // The detailed transition.
444    oneof detail {
445      // Intent route or condition route.
446      TransitionRoute transition_route = 5;
447
448      // Event handler.
449      EventHandler event_handler = 6;
450    }
451  }
452
453  // The list of Transitions present in the agent.
454  repeated Transition transitions = 1;
455
456  // The percent of transitions in the agent that are covered.
457  float coverage_score = 2;
458}
459
460// Transition route group coverage represents the percentage of all possible
461// transition routes present within any of a parent's test cases. The results
462// are grouped by the transition route group.
463message TransitionRouteGroupCoverage {
464  // Coverage result message for one transition route group.
465  message Coverage {
466    // A transition coverage in a transition route group.
467    message Transition {
468      // Intent route or condition route.
469      TransitionRoute transition_route = 1;
470
471      // Whether the transition route is covered by at least one of the
472      // agent's test cases.
473      bool covered = 2;
474    }
475
476    // Transition route group metadata. Only name and displayName will be set.
477    TransitionRouteGroup route_group = 1;
478
479    // The list of transition routes and coverage in the transition route group.
480    repeated Transition transitions = 2;
481
482    // The percent of transition routes in the transition route group that are
483    // covered.
484    float coverage_score = 3;
485  }
486
487  // Transition route group coverages.
488  repeated Coverage coverages = 1;
489
490  // The percent of transition routes in all the transition route groups that
491  // are covered.
492  float coverage_score = 2;
493}
494
495// Intent coverage represents the percentage of all possible intents in the
496// agent that are triggered in any of a parent's test cases.
497message IntentCoverage {
498  // The agent's intent.
499  message Intent {
500    // The intent full resource name
501    string intent = 1 [(google.api.resource_reference) = {
502      type: "dialogflow.googleapis.com/Intent"
503    }];
504
505    // Whether the intent is covered by at least one of the agent's
506    // test cases.
507    bool covered = 2;
508  }
509
510  // The list of Intents present in the agent
511  repeated Intent intents = 1;
512
513  // The percent of intents in the agent that are covered.
514  float coverage_score = 2;
515}
516
517// The request message for
518// [TestCases.CalculateCoverage][google.cloud.dialogflow.cx.v3.TestCases.CalculateCoverage].
519message CalculateCoverageRequest {
520  // The type of coverage score requested.
521  enum CoverageType {
522    // Should never be used.
523    COVERAGE_TYPE_UNSPECIFIED = 0;
524
525    // Intent coverage.
526    INTENT = 1;
527
528    // Page transition coverage.
529    PAGE_TRANSITION = 2;
530
531    // Transition route group coverage.
532    TRANSITION_ROUTE_GROUP = 3;
533  }
534
535  // Required. The agent to calculate coverage for.
536  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
537  string agent = 3 [
538    (google.api.field_behavior) = REQUIRED,
539    (google.api.resource_reference) = {
540      type: "dialogflow.googleapis.com/Agent"
541    }
542  ];
543
544  // Required. The type of coverage requested.
545  CoverageType type = 2 [(google.api.field_behavior) = REQUIRED];
546}
547
548// The response message for
549// [TestCases.CalculateCoverage][google.cloud.dialogflow.cx.v3.TestCases.CalculateCoverage].
550message CalculateCoverageResponse {
551  // The agent to calculate coverage for.
552  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
553  string agent = 5 [(google.api.resource_reference) = {
554    type: "dialogflow.googleapis.com/Agent"
555  }];
556
557  // The type of coverage requested.
558  oneof coverage_type {
559    // Intent coverage.
560    IntentCoverage intent_coverage = 2;
561
562    // Transition (excluding transition route groups) coverage.
563    TransitionCoverage transition_coverage = 4;
564
565    // Transition route group coverage.
566    TransitionRouteGroupCoverage route_group_coverage = 6;
567  }
568}
569
570// The request message for
571// [TestCases.ListTestCases][google.cloud.dialogflow.cx.v3.TestCases.ListTestCases].
572message ListTestCasesRequest {
573  // Specifies how much test case information to include in the response.
574  enum TestCaseView {
575    // The default / unset value.
576    // The API will default to the BASIC view.
577    TEST_CASE_VIEW_UNSPECIFIED = 0;
578
579    // Include basic metadata about the test case, but not the conversation
580    // turns. This is the default value.
581    BASIC = 1;
582
583    // Include everything.
584    FULL = 2;
585  }
586
587  // Required. The agent to list all pages for.
588  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
589  string parent = 1 [
590    (google.api.field_behavior) = REQUIRED,
591    (google.api.resource_reference) = {
592      child_type: "dialogflow.googleapis.com/TestCase"
593    }
594  ];
595
596  // The maximum number of items to return in a single page. By default 20.
597  // Note that when TestCaseView = FULL, the maximum page size allowed is 20.
598  // When TestCaseView = BASIC, the maximum page size allowed is 500.
599  int32 page_size = 2;
600
601  // The next_page_token value returned from a previous list request.
602  string page_token = 3;
603
604  // Specifies whether response should include all fields or just the metadata.
605  TestCaseView view = 4;
606}
607
608// The response message for
609// [TestCases.ListTestCases][google.cloud.dialogflow.cx.v3.TestCases.ListTestCases].
610message ListTestCasesResponse {
611  // The list of test cases. There will be a maximum number of items returned
612  // based on the page_size field in the request.
613  repeated TestCase test_cases = 1;
614
615  // Token to retrieve the next page of results, or empty if there are no more
616  // results in the list.
617  string next_page_token = 2;
618}
619
620// The request message for
621// [TestCases.BatchDeleteTestCases][google.cloud.dialogflow.cx.v3.TestCases.BatchDeleteTestCases].
622message BatchDeleteTestCasesRequest {
623  // Required. The agent to delete test cases from.
624  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
625  string parent = 1 [
626    (google.api.field_behavior) = REQUIRED,
627    (google.api.resource_reference) = {
628      child_type: "dialogflow.googleapis.com/TestCase"
629    }
630  ];
631
632  // Required. Format of test case names: `projects/<Project ID>/locations/
633  // <Location ID>/agents/<AgentID>/testCases/<TestCase ID>`.
634  repeated string names = 3 [
635    (google.api.field_behavior) = REQUIRED,
636    (google.api.resource_reference) = {
637      type: "dialogflow.googleapis.com/TestCase"
638    }
639  ];
640}
641
642// The request message for
643// [TestCases.CreateTestCase][google.cloud.dialogflow.cx.v3.TestCases.CreateTestCase].
644message CreateTestCaseRequest {
645  // Required. The agent to create the test case for.
646  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
647  string parent = 1 [
648    (google.api.field_behavior) = REQUIRED,
649    (google.api.resource_reference) = {
650      child_type: "dialogflow.googleapis.com/TestCase"
651    }
652  ];
653
654  // Required. The test case to create.
655  TestCase test_case = 2 [(google.api.field_behavior) = REQUIRED];
656}
657
658// The request message for
659// [TestCases.UpdateTestCase][google.cloud.dialogflow.cx.v3.TestCases.UpdateTestCase].
660message UpdateTestCaseRequest {
661  // Required. The test case to update.
662  TestCase test_case = 1 [(google.api.field_behavior) = REQUIRED];
663
664  // Required. The mask to specify which fields should be updated. The
665  // [`creationTime`][google.cloud.dialogflow.cx.v3.TestCase.creation_time] and
666  // [`lastTestResult`][google.cloud.dialogflow.cx.v3.TestCase.last_test_result]
667  // cannot be updated.
668  google.protobuf.FieldMask update_mask = 2
669      [(google.api.field_behavior) = REQUIRED];
670}
671
672// The request message for
673// [TestCases.GetTestCase][google.cloud.dialogflow.cx.v3.TestCases.GetTestCase].
674message GetTestCaseRequest {
675  // Required. The name of the testcase.
676  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
677  // ID>/testCases/<TestCase ID>`.
678  string name = 1 [
679    (google.api.field_behavior) = REQUIRED,
680    (google.api.resource_reference) = {
681      type: "dialogflow.googleapis.com/TestCase"
682    }
683  ];
684}
685
686// The request message for
687// [TestCases.RunTestCase][google.cloud.dialogflow.cx.v3.TestCases.RunTestCase].
688message RunTestCaseRequest {
689  // Required. Format of test case name to run: `projects/<Project
690  // ID>/locations/ <Location ID>/agents/<AgentID>/testCases/<TestCase ID>`.
691  string name = 1 [
692    (google.api.field_behavior) = REQUIRED,
693    (google.api.resource_reference) = {
694      type: "dialogflow.googleapis.com/TestCase"
695    }
696  ];
697
698  // Optional. Environment name. If not set, draft environment is assumed.
699  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
700  // ID>/environments/<Environment ID>`.
701  string environment = 2 [
702    (google.api.field_behavior) = OPTIONAL,
703    (google.api.resource_reference) = {
704      type: "dialogflow.googleapis.com/Environment"
705    }
706  ];
707}
708
709// The response message for
710// [TestCases.RunTestCase][google.cloud.dialogflow.cx.v3.TestCases.RunTestCase].
711message RunTestCaseResponse {
712  // The result.
713  TestCaseResult result = 2;
714}
715
716// Metadata returned for the
717// [TestCases.RunTestCase][google.cloud.dialogflow.cx.v3.TestCases.RunTestCase]
718// long running operation. This message currently has no fields.
719message RunTestCaseMetadata {}
720
721// The request message for
722// [TestCases.BatchRunTestCases][google.cloud.dialogflow.cx.v3.TestCases.BatchRunTestCases].
723message BatchRunTestCasesRequest {
724  // Required. Agent name. Format: `projects/<Project ID>/locations/<Location
725  // ID>/agents/ <AgentID>`.
726  string parent = 1 [
727    (google.api.field_behavior) = REQUIRED,
728    (google.api.resource_reference) = {
729      child_type: "dialogflow.googleapis.com/TestCase"
730    }
731  ];
732
733  // Optional. If not set, draft environment is assumed. Format:
734  // `projects/<Project ID>/locations/<Location ID>/agents/<Agent
735  // ID>/environments/<Environment ID>`.
736  string environment = 2 [
737    (google.api.field_behavior) = OPTIONAL,
738    (google.api.resource_reference) = {
739      type: "dialogflow.googleapis.com/Environment"
740    }
741  ];
742
743  // Required. Format: `projects/<Project ID>/locations/<Location
744  // ID>/agents/<Agent ID>/testCases/<TestCase ID>`.
745  repeated string test_cases = 3 [
746    (google.api.field_behavior) = REQUIRED,
747    (google.api.resource_reference) = {
748      type: "dialogflow.googleapis.com/TestCase"
749    }
750  ];
751}
752
753// The response message for
754// [TestCases.BatchRunTestCases][google.cloud.dialogflow.cx.v3.TestCases.BatchRunTestCases].
755message BatchRunTestCasesResponse {
756  // The test case results. The detailed
757  // [conversation
758  // turns][google.cloud.dialogflow.cx.v3.TestCaseResult.conversation_turns] are
759  // empty in this response.
760  repeated TestCaseResult results = 1;
761}
762
763// Metadata returned for the
764// [TestCases.BatchRunTestCases][google.cloud.dialogflow.cx.v3.TestCases.BatchRunTestCases]
765// long running operation.
766message BatchRunTestCasesMetadata {
767  // The test errors.
768  repeated TestError errors = 1;
769}
770
771// Error info for running a test.
772message TestError {
773  // The test case resource name.
774  string test_case = 1 [(google.api.resource_reference) = {
775    type: "dialogflow.googleapis.com/TestCase"
776  }];
777
778  // The status associated with the test.
779  google.rpc.Status status = 2;
780
781  // The timestamp when the test was completed.
782  google.protobuf.Timestamp test_time = 3;
783}
784
785// The request message for
786// [TestCases.ImportTestCases][google.cloud.dialogflow.cx.v3.TestCases.ImportTestCases].
787message ImportTestCasesRequest {
788  // Required. The agent to import test cases to.
789  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
790  string parent = 1 [
791    (google.api.field_behavior) = REQUIRED,
792    (google.api.resource_reference) = {
793      child_type: "dialogflow.googleapis.com/TestCase"
794    }
795  ];
796
797  // Required. The source to import.
798  oneof source {
799    // The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI
800    // to import test cases from. The format of this URI must be
801    // `gs://<bucket-name>/<object-name>`.
802    //
803    // Dialogflow performs a read operation for the Cloud Storage object
804    // on the caller's behalf, so your request authentication must
805    // have read permissions for the object. For more information, see
806    // [Dialogflow access
807    // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
808    string gcs_uri = 2;
809
810    // Uncompressed raw byte content for test cases.
811    bytes content = 3;
812  }
813}
814
815// The response message for
816// [TestCases.ImportTestCases][google.cloud.dialogflow.cx.v3.TestCases.ImportTestCases].
817message ImportTestCasesResponse {
818  // The unique identifiers of the new test cases.
819  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
820  // ID>/testCases/<TestCase ID>`.
821  repeated string names = 1 [(google.api.resource_reference) = {
822    type: "dialogflow.googleapis.com/TestCase"
823  }];
824}
825
826// Metadata returned for the
827// [TestCases.ImportTestCases][google.cloud.dialogflow.cx.v3.TestCases.ImportTestCases]
828// long running operation.
829message ImportTestCasesMetadata {
830  // Errors for failed test cases.
831  repeated TestCaseError errors = 1;
832}
833
834// Error info for importing a test.
835message TestCaseError {
836  // The test case.
837  TestCase test_case = 1;
838
839  // The status associated with the test case.
840  google.rpc.Status status = 2;
841}
842
843// The request message for
844// [TestCases.ExportTestCases][google.cloud.dialogflow.cx.v3.TestCases.ExportTestCases].
845message ExportTestCasesRequest {
846  // Data format of the exported test cases.
847  enum DataFormat {
848    // Unspecified format.
849    DATA_FORMAT_UNSPECIFIED = 0;
850
851    // Raw bytes.
852    BLOB = 1;
853
854    // JSON format.
855    JSON = 2;
856  }
857
858  // Required. The agent where to export test cases from.
859  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
860  string parent = 1 [
861    (google.api.field_behavior) = REQUIRED,
862    (google.api.resource_reference) = {
863      child_type: "dialogflow.googleapis.com/TestCase"
864    }
865  ];
866
867  // The destination to export.
868  oneof destination {
869    // The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI to
870    // export the test cases to. The format of this URI must be
871    // `gs://<bucket-name>/<object-name>`. If unspecified, the serialized test
872    // cases is returned inline.
873    //
874    // Dialogflow performs a write operation for the Cloud Storage object
875    // on the caller's behalf, so your request authentication must
876    // have write permissions for the object. For more information, see
877    // [Dialogflow access
878    // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
879    string gcs_uri = 2;
880  }
881
882  // The data format of the exported test cases. If not specified, `BLOB` is
883  // assumed.
884  DataFormat data_format = 3;
885
886  // The filter expression used to filter exported test cases, see
887  // [API Filtering](https://aip.dev/160). The expression is case insensitive
888  // and supports the following syntax:
889  //
890  //   name = <value> [OR name = <value>] ...
891  //
892  // For example:
893  //
894  // *   "name = t1 OR name = t2" matches the test case with the exact resource
895  //     name "t1" or "t2".
896  string filter = 4;
897}
898
899// The response message for
900// [TestCases.ExportTestCases][google.cloud.dialogflow.cx.v3.TestCases.ExportTestCases].
901message ExportTestCasesResponse {
902  // The exported test cases.
903  oneof destination {
904    // The URI to a file containing the exported test cases. This field is
905    // populated only if `gcs_uri` is specified in
906    // [ExportTestCasesRequest][google.cloud.dialogflow.cx.v3.ExportTestCasesRequest].
907    string gcs_uri = 1;
908
909    // Uncompressed raw byte content for test cases.
910    bytes content = 2;
911  }
912}
913
914// Metadata returned for the
915// [TestCases.ExportTestCases][google.cloud.dialogflow.cx.v3.TestCases.ExportTestCases]
916// long running operation. This message currently has no fields.
917message ExportTestCasesMetadata {}
918
919// The request message for
920// [TestCases.ListTestCaseResults][google.cloud.dialogflow.cx.v3.TestCases.ListTestCaseResults].
921message ListTestCaseResultsRequest {
922  // Required. The test case to list results for.
923  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/
924  // testCases/<TestCase ID>`. Specify a `-` as a wildcard for TestCase ID to
925  // list results across multiple test cases.
926  string parent = 1 [
927    (google.api.field_behavior) = REQUIRED,
928    (google.api.resource_reference) = {
929      child_type: "dialogflow.googleapis.com/TestCaseResult"
930    }
931  ];
932
933  // The maximum number of items to return in a single page. By default 100 and
934  // at most 1000.
935  int32 page_size = 2;
936
937  // The next_page_token value returned from a previous list request.
938  string page_token = 3;
939
940  // The filter expression used to filter test case results. See
941  // [API Filtering](https://aip.dev/160).
942  //
943  // The expression is case insensitive. Only 'AND' is supported for logical
944  // operators. The supported syntax is listed below in detail:
945  //
946  //   <field> <operator> <value> [AND <field> <operator> <value>] ...
947  //   [AND latest]
948  //
949  // The supported fields and operators are:
950  // field                 operator
951  // `environment`         `=`, `IN`  (Use value `draft` for draft environment)
952  // `test_time`           `>`, `<`
953  //
954  // `latest` only returns the latest test result in all results for each test
955  // case.
956  //
957  // Examples:
958  // *   "environment=draft AND latest" matches the latest test result for each
959  //     test case in the draft environment.
960  // *   "environment IN (e1,e2)" matches any test case results with an
961  //     environment resource name of either "e1" or "e2".
962  // *   "test_time > 1602540713" matches any test case results with test time
963  //     later than a unix timestamp in seconds 1602540713.
964  string filter = 4;
965}
966
967// The response message for
968// [TestCases.ListTestCaseResults][google.cloud.dialogflow.cx.v3.TestCases.ListTestCaseResults].
969message ListTestCaseResultsResponse {
970  // The list of test case results.
971  repeated TestCaseResult test_case_results = 1;
972
973  // Token to retrieve the next page of results, or empty if there are no more
974  // results in the list.
975  string next_page_token = 2;
976}
977
978// The request message for
979// [TestCases.GetTestCaseResult][google.cloud.dialogflow.cx.v3.TestCases.GetTestCaseResult].
980message GetTestCaseResultRequest {
981  // Required. The name of the testcase.
982  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
983  // ID>/testCases/<TestCase ID>/results/<TestCaseResult ID>`.
984  string name = 1 [
985    (google.api.field_behavior) = REQUIRED,
986    (google.api.resource_reference) = {
987      type: "dialogflow.googleapis.com/TestCaseResult"
988    }
989  ];
990}
991
992// The test result for a test case and an agent environment.
993enum TestResult {
994  // Not specified. Should never be used.
995  TEST_RESULT_UNSPECIFIED = 0;
996
997  // The test passed.
998  PASSED = 1;
999
1000  // The test did not pass.
1001  FAILED = 2;
1002}
1003