---
title: "record(_:sourceLocation:)"
framework: testing
role: symbol
role_heading: Type Method
path: "testing/attachment/record(_:sourcelocation:)"
---

# record(_:sourceLocation:)

Attach an attachment to the current test.

## Declaration

```swift
static func record(_ attachment: consuming Attachment<AttachableValue>, sourceLocation: SourceLocation = #_sourceLocation)
```

## Parameters

- `attachment`: The attachment to attach.
- `sourceLocation`: The source location of the call to this function.

## Discussion

Discussion When attachableValue is an instance of a type that does not conform to the Sendable protocol, the testing library calls its withUnsafeBytes(for:_:) immediately and records a copy of the resulting buffer instead. If attachableValue throws an error when the testing library calls its withUnsafeBytes(for:_:) function, the testing library records that error as an issue in the current test.
