Skip to main content

test_cases

Creates, updates, deletes, gets or lists a test_cases resource.

Overview

Nametest_cases
TypeResource
Idgoogle.dialogflow.test_cases

Fields

NameDatatypeDescription
namestringThe unique identifier of the test case. TestCases.CreateTestCase will populate the name automatically. Otherwise use format: projects//locations//agents//testCases/.
creationTimestringOutput only. When the test was created.
displayNamestringRequired. The human-readable name of the test case, unique within the agent. Limit of 200 characters.
lastTestResultobjectRepresents a result from running a test case in an agent environment.
notesstringAdditional freeform notes about the test case. Limit of 400 characters.
tagsarrayTags are short descriptions that users may apply to test cases for organizational and filtering purposes. Each tag should start with "#" and has a limit of 30 characters.
testCaseConversationTurnsarrayThe conversation turns uttered when the test case was created, in chronological order. These include the canonical set of agent utterances that should occur when the agent is working properly.
testConfigobjectRepresents configurations for a test case.

Methods

NameAccessible byRequired ParamsDescription
projects_locations_agents_test_cases_getSELECTagentsId, locationsId, projectsId, testCasesIdGets a test case.
projects_locations_agents_test_cases_listSELECTagentsId, locationsId, projectsIdFetches a list of test cases for a given agent.
projects_locations_agents_test_cases_createINSERTagentsId, locationsId, projectsIdCreates a test case for the given agent.
projects_locations_agents_test_cases_batch_deleteDELETEagentsId, locationsId, projectsIdBatch deletes test cases.
projects_locations_agents_test_cases_patchUPDATEagentsId, locationsId, projectsId, testCasesIdUpdates the specified test case.
projects_locations_agents_test_cases_batch_runEXECagentsId, locationsId, projectsIdKicks off a batch run of test cases. This method is a long-running operation. The returned Operation type has the following method-specific fields: - metadata: BatchRunTestCasesMetadata - response: BatchRunTestCasesResponse
projects_locations_agents_test_cases_calculate_coverageEXECagentsId, locationsId, projectsIdCalculates the test coverage for an agent.
projects_locations_agents_test_cases_exportEXECagentsId, locationsId, projectsIdExports the test cases under the agent to a Cloud Storage bucket or a local file. Filter can be applied to export a subset of test cases. This method is a long-running operation. The returned Operation type has the following method-specific fields: - metadata: ExportTestCasesMetadata - response: ExportTestCasesResponse
projects_locations_agents_test_cases_importEXECagentsId, locationsId, projectsIdImports the test cases from a Cloud Storage bucket or a local file. It always creates new test cases and won't overwrite any existing ones. The provided ID in the imported test case is neglected. This method is a long-running operation. The returned Operation type has the following method-specific fields: - metadata: ImportTestCasesMetadata - response: ImportTestCasesResponse
projects_locations_agents_test_cases_runEXECagentsId, locationsId, projectsId, testCasesIdKicks off a test case run. This method is a long-running operation. The returned Operation type has the following method-specific fields: - metadata: RunTestCaseMetadata - response: RunTestCaseResponse

SELECT examples

Fetches a list of test cases for a given agent.

SELECT
name,
creationTime,
displayName,
lastTestResult,
notes,
tags,
testCaseConversationTurns,
testConfig
FROM google.dialogflow.test_cases
WHERE agentsId = '{{ agentsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new test_cases resource.

/*+ create */
INSERT INTO google.dialogflow.test_cases (
agentsId,
locationsId,
projectsId,
name,
tags,
displayName,
notes,
testConfig,
testCaseConversationTurns,
lastTestResult
)
SELECT
'{{ agentsId }}',
'{{ locationsId }}',
'{{ projectsId }}',
'{{ name }}',
'{{ tags }}',
'{{ displayName }}',
'{{ notes }}',
'{{ testConfig }}',
'{{ testCaseConversationTurns }}',
'{{ lastTestResult }}'
;

UPDATE example

Updates a test_cases resource.

/*+ update */
UPDATE google.dialogflow.test_cases
SET
name = '{{ name }}',
tags = '{{ tags }}',
displayName = '{{ displayName }}',
notes = '{{ notes }}',
testConfig = '{{ testConfig }}',
testCaseConversationTurns = '{{ testCaseConversationTurns }}',
lastTestResult = '{{ lastTestResult }}'
WHERE
agentsId = '{{ agentsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}'
AND testCasesId = '{{ testCasesId }}';

DELETE example

Deletes the specified test_cases resource.

/*+ delete */
DELETE FROM google.dialogflow.test_cases
WHERE agentsId = '{{ agentsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';