SiriTranscript
The immutable record of one scenario’s execution.
Declaration
struct SiriTranscriptOverview
A transcript records what Siri does while running one scenario. For each turn, it holds:
the intents Siri calls, with their arguments
how each call ends
the entities Siri finds
the entities onscreen
the skills Siri loads
the reply Siri gives
A SiriExpectationEvaluator reads the transcript to compute metrics. When you write an evaluator of your own, read the transcript through the siriTranscript property of the evaluation subject.
Look up a turn with turn(for:) using the identifier of the UserTurn that produces it, not its position. Identifier lookup keeps a run that stops early from pairing a recorded turn with the wrong turn from the scenario.
The following shows a function that counts the intents Siri runs during a turn:
func ranIntentCount(for turn: UserTurn, in subject: SiriScenarioSubject) -> Int {
// Look up the recorded turn by the identifier.
guard let recorded = subject.siriTranscript.turn(for: turn.id) else {
return 0
}
// Count the calls that run, not the ones that stop to ask a
// question or fail.
return recorded.intentInvocations
.filter { $0.value.outcome.ran }
.count
}