test_case.proto 34 KB

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