<!--
{
  "availability" : [
    "*: -",
    "Xcode: 16.0.0 -",
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "swift: 6.0.0 -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Testing",
  "identifier" : "/documentation/Testing/Issue/record(_:sourceLocation:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Swift Testing",
      "Testing"
    ],
    "preciseIdentifier" : "s:7Testing5IssueV6record_14sourceLocationAcA7CommentVSg_AA06SourceE0VtFZ"
  },
  "title" : "record(_:sourceLocation:)"
}
-->

# record(_:sourceLocation:)

Records an issue that a test encounters while it’s running.

```
@discardableResult static func record(_ comment: Comment? = nil, sourceLocation: SourceLocation = #_sourceLocation) -> Issue
```

## Parameters

`comment`

A comment describing the expectation.

`sourceLocation`

The source location to which the issue should be
attributed.

## Return Value

The issue that was recorded.

## Discussion

Use this function if, while running a test, an issue occurs that cannot be
represented as an expectation (using the [`expect(_:_:sourceLocation:)`](/documentation/Testing/expect(_:_:sourceLocation:))
or [`require(_:_:sourceLocation:)`](/documentation/Testing/require(_:_:sourceLocation:)-5l63q) macros.)

---

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)