Method: projects.locations.agents.testCases.calculateCoverage

Calculates the test coverage for an agent.

HTTP request

GET https://{endpoint}/v3/{agent=projects/*/locations/*/agents/*}/testCases:calculateCoverage

Where {endpoint} is one of the supported service endpoints.

The URLs use gRPC Transcoding syntax.

Path parameters

Parameters
agent

string

Required. The agent to calculate coverage for. Format: projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>.

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

The response message for TestCases.CalculateCoverage.

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

JSON representation
{
  "agent": string,

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

string

The agent to calculate coverage for. Format: projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>.

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 (excluding transition route groups) coverage.

routeGroupCoverage

object (TransitionRouteGroupCoverage)

Transition route group 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.
TRANSITION_ROUTE_GROUP Transition route group 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 the intent is covered by at least one of the agent's test cases.

TransitionCoverage

Transition coverage represents the percentage of all possible page transitions (page-level transition routes and event handlers, excluding transition route groups) 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 a page.

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 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.

TransitionRouteGroupCoverage

Transition route group coverage represents the percentage of all possible transition routes present within any of a parent's test cases. The results are grouped by the transition route group.

JSON representation
{
  "coverages": [
    {
      object (Coverage)
    }
  ],
  "coverageScore": number
}
Fields
coverages[]

object (Coverage)

Transition route group coverages.

coverageScore

number

The percent of transition routes in all the transition route groups that are covered.

Coverage

Coverage result message for one transition route group.

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

object (TransitionRouteGroup)

Transition route group metadata. Only name and displayName will be set.

transitions[]

object (Transition)

The list of transition routes and coverage in the transition route group.

coverageScore

number

The percent of transition routes in the transition route group that are covered.

Transition

A transition coverage in a transition route group.

JSON representation
{
  "transitionRoute": {
    object (TransitionRoute)
  },
  "covered": boolean
}
Fields
transitionRoute

object (TransitionRoute)

Intent route or condition route.

covered

boolean

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