|
| 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 | +# https://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 | + |
| 15 | +# [START dialogflow_list_test_case_results_sample] |
| 16 | + |
| 17 | +from google.cloud.dialogflowcx_v3.services.test_cases.client import TestCasesClient |
| 18 | +from google.cloud.dialogflowcx_v3.types.test_case import ListTestCaseResultsRequest |
| 19 | + |
| 20 | + |
| 21 | +def list_test_case(project_id, agent_id, test_id, location): |
| 22 | + |
| 23 | + req = ListTestCaseResultsRequest() |
| 24 | + req.parent = f"projects/{project_id}/locations/{location}/agents/{agent_id}/testCases/{test_id}" |
| 25 | + req.filter = "environment=draft" |
| 26 | + client = TestCasesClient( |
| 27 | + client_options={"api_endpoint": f"{location}-dialogflow.googleapis.com"} |
| 28 | + ) |
| 29 | + # Makes a call to list all test case results that match filter |
| 30 | + result = client.list_test_case_results(request=req) |
| 31 | + print(result) |
| 32 | + return result |
| 33 | + |
| 34 | + |
| 35 | +# [END dialogflow_list_test_case_results_sample] |
0 commit comments