Method: projects.locations.agents.testCases.calculateCoverage

Calculates the test coverage for an agent.

HTTP request

GET https://dialogflow.googleapis.com/v3beta1/{agent=projects/*/locations/*/agents/*}/testCases:calculateCoverage

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
agent

string

Required. The agent to calculate coverage for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

Authorization requires the following IAM permission on the specified resource agent:

  • dialogflow.testcases.calculateCoverage

Query parameters

Parameters
type

enum (CoverageType)

Required. The type of coverage requested.

Request body

The request body must be empty.

Response body

If successful, the response body contains data with the following structure:

The response message for TestCases.CalculateCoverage.

JSON representation
{
  "agent": string,

  // Union field coverage_type can be only one of the following:
  "intentCoverage": {
    object (IntentCoverage)
  },
  "transitionCoverage": {
    object (TransitionCoverage)
  }
  // End of list of possible types for union field coverage_type.
}
Fields
agent

string

The agent to calculate coverage for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

Union field coverage_type. The type of coverage requested. coverage_type can be only one of the following:
intentCoverage

object (IntentCoverage)

Intent coverage.

transitionCoverage

object (TransitionCoverage)

Transition coverage.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/dialogflow

For more information, see the Authentication Overview.

CoverageType

The type of coverage score requested.

Enums
COVERAGE_TYPE_UNSPECIFIED Should never be used.
INTENT Intent coverage.
PAGE_TRANSITION Page transition coverage

IntentCoverage

Intent coverage represents the percentage of all possible intents in the agent that are triggered in any of a parent's test cases.

JSON representation
{
  "intents": [
    {
      object (Intent)
    }
  ],
  "coverageScore": number
}
Fields
intents[]

object (Intent)

The list of Intents present in the agent

coverageScore

number

The percent of intents in the agent that are covered.

Intent

The agent's intent.

JSON representation
{
  "intent": string,
  "covered": boolean
}
Fields
intent

string

The intent full resource name

covered

boolean

Whether or not the intent is covered by at least one of the agent's test cases.

TransitionCoverage

Transition coverage represents the percentage of all possible transitions present within any of a parent's test cases.

JSON representation
{
  "transitions": [
    {
      object (Transition)
    }
  ],
  "coverageScore": number
}
Fields
transitions[]

object (Transition)

The list of Transitions present in the agent.

coverageScore

number

The percent of transitions in the agent that are covered.

Transition

A transition in the agent's graph.

JSON representation
{
  "source": {
    object (TransitionNode)
  },
  "index": integer,
  "target": {
    object (TransitionNode)
  },
  "covered": boolean,

  // Union field detail can be only one of the following:
  "transitionRoute": {
    object (TransitionRoute)
  },
  "eventHandler": {
    object (EventHandler)
  }
  // End of list of possible types for union field detail.
}
Fields
source

object (TransitionNode)

The start node of a transition.

index

integer

The index of a transition in the transition list. Starting from 0.

target

object (TransitionNode)

The end node of a transition.

covered

boolean

Whether or not the transition is covered by at least one of the agent's test cases.

Union field detail. The detailed transition. detail can be only one of the following:
transitionRoute

object (TransitionRoute)

Intent route or condition route.

eventHandler

object (EventHandler)

Event handler.

TransitionNode

The source or target of a transition.

JSON representation
{

  // Union field kind can be only one of the following:
  "page": {
    object (Page)
  },
  "flow": {
    object (Flow)
  }
  // End of list of possible types for union field kind.
}
Fields
Union field kind. A TransitionNode can be either a page or a flow. kind can be only one of the following:
page

object (Page)

Indicates a transition to a Page. Only some fields such as name and displayname will be set.

flow

object (Flow)

Indicates a transition to a Flow. Only some fields such as name and displayname will be set.