<!--
{
  "availability" : [
    "Xcode: 16.0.0 -",
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "swift: 6.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Testing",
  "identifier" : "/documentation/Testing/TestTrait/evaluates(_:info:recordTranscripts:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Swift Testing",
      "Testing"
    ],
    "preciseIdentifier" : "s:7Testing9TestTraitP11EvaluationsAD010EvaluationC0VRszrlE9evaluates_4info17recordTranscriptsAfD0E0_p_SDyS2SGSbtFZ"
  },
  "title" : "evaluates(_:info:recordTranscripts:)"
}
-->

# evaluates(_:info:recordTranscripts:)

Creates a trait that runs a single evaluation and makes its result available
through the current evaluation context.

```
static func evaluates(_ evaluation: any Evaluation, info: [String : String] = [:], recordTranscripts: Bool = false) -> Self
```

## Parameters

`evaluation`

The evaluation to run.

`info`

User-defined key-value pairs attached to the result, such as model name or dataset version.

`recordTranscripts`

When `true`, each row’s transcript snapshot is embedded in the
`.xcevalresult` attachment under the `Transcript` column. Recoverable on load via
`EvaluationResult/transcriptSnapshots`. Defaults to `false` so the attachment
stays small for runs that don’t need transcripts.

## Discussion

```swift
let accuracyMetric = Metric("Accuracy")

@Test(.evaluates(myEvaluation, info: ["model": "gpt-4"]))
func testAccuracy() async throws {
    let result = EvaluationContext.current.result
    #expect(result.aggregateValue(.mean(of: accuracyMetric)) >= 0.8)
}
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)