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