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

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringThe unique identifier of the test case. TestCases.CreateTestCase will populate the name automatically. Otherwise use format: projects//locations//agents//testCases/.
creationTimestring (google-datetime)Output only. When the test was created.
displayNamestringRequired. The human-readable name of the test case, unique within the agent. Limit of 200 characters.
lastTestResultobjectThe latest test result. (id: GoogleCloudDialogflowCxV3TestCaseResult)
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.
testConfigobjectConfig for the test case. (id: GoogleCloudDialogflowCxV3TestConfig)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_locations_agents_test_cases_getselectprojectsId, locationsId, agentsId, testCasesIdGets a test case.
projects_locations_agents_test_cases_listselectprojectsId, locationsId, agentsIdpageSize, pageToken, viewFetches a list of test cases for a given agent.
projects_locations_agents_test_cases_createinsertprojectsId, locationsId, agentsIdCreates a test case for the given agent.
projects_locations_agents_test_cases_patchupdateprojectsId, locationsId, agentsId, testCasesIdupdateMaskUpdates the specified test case.
projects_locations_agents_test_cases_batch_deletedeleteprojectsId, locationsId, agentsIdBatch deletes test cases.
projects_locations_agents_test_cases_runexecprojectsId, locationsId, agentsId, 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
projects_locations_agents_test_cases_batch_runexecprojectsId, locationsId, agentsIdKicks 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_coverageexecprojectsId, locationsId, agentsIdtypeCalculates the test coverage for an agent.
projects_locations_agents_test_cases_importexecprojectsId, locationsId, agentsIdImports 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_exportexecprojectsId, locationsId, agentsIdExports 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

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
agentsIdstring
locationsIdstring
projectsIdstring
testCasesIdstring
pageSizeinteger (int32)
pageTokenstring
typestring
updateMaskstring (google-fieldmask)
viewstring

SELECT examples

Gets a test case.

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

INSERT examples

Creates a test case for the given agent.

INSERT INTO google.dialogflow.test_cases (
data__name,
data__tags,
data__displayName,
data__notes,
data__testConfig,
data__testCaseConversationTurns,
data__lastTestResult,
projectsId,
locationsId,
agentsId
)
SELECT
'{{ name }}',
'{{ tags }}',
'{{ displayName }}',
'{{ notes }}',
'{{ testConfig }}',
'{{ testCaseConversationTurns }}',
'{{ lastTestResult }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ agentsId }}'
RETURNING
name,
creationTime,
displayName,
lastTestResult,
notes,
tags,
testCaseConversationTurns,
testConfig
;

UPDATE examples

Updates the specified test case.

UPDATE google.dialogflow.test_cases
SET
data__name = '{{ name }}',
data__tags = '{{ tags }}',
data__displayName = '{{ displayName }}',
data__notes = '{{ notes }}',
data__testConfig = '{{ testConfig }}',
data__testCaseConversationTurns = '{{ testCaseConversationTurns }}',
data__lastTestResult = '{{ lastTestResult }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND agentsId = '{{ agentsId }}' --required
AND testCasesId = '{{ testCasesId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
creationTime,
displayName,
lastTestResult,
notes,
tags,
testCaseConversationTurns,
testConfig;

DELETE examples

Batch deletes test cases.

DELETE FROM google.dialogflow.test_cases
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND agentsId = '{{ agentsId }}' --required;

Lifecycle Methods

Kicks 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

EXEC google.dialogflow.test_cases.projects_locations_agents_test_cases_run 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@agentsId='{{ agentsId }}' --required,
@testCasesId='{{ testCasesId }}' --required
@@json=
'{
"environment": "{{ environment }}"
}';