Method: projects.locations.agents.testCases.calculateCoverage

Calculates the test coverage for an agent.

HTTP request

GET https://{endpoint}/v3beta1/{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,

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "intentCoverage": {
    object (IntentCoverage)
  },
  "transitionCoverage": {
    object (TransitionCoverage)
  },
  "routeGroupCoverage": {
    object (TransitionRouteGroupCoverage)
  }
  // End of mutually exclusive fields.
}
Fields
agent

string

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

The type of coverage requested. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response:
intentCoverage

object (IntentCoverage)

Intent coverage.

transitionCoverage

object (TransitionCoverage)

Transition (excluding transition route groups) coverage.

routeGroupCoverage

object (TransitionRouteGroupCoverage)

Transition route group coverage.

End of mutually exclusive fields.

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,

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "transitionRoute": {
    object (TransitionRoute)
  },
  "eventHandler": {
    object (EventHandler)
  }
  // End of mutually exclusive fields.
}
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.

The detailed transition. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response:
transitionRoute

object (TransitionRoute)

Intent route or condition route.

eventHandler

object (EventHandler)

Event handler.

End of mutually exclusive fields.

TransitionNode

The source or target of a transition.

JSON representation
{

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "page": {
    object (Page)
  },
  "flow": {
    object (Flow)
  }
  // End of mutually exclusive fields.
}
Fields
A TransitionNode can be either a page or a flow. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response:
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.

End of mutually exclusive fields.

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.