test_case.proto 31 KB

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