---
title: "encodeTestArgument(to:)"
framework: testing
role: symbol
role_heading: Instance Method
path: "testing/customtestargumentencodable/encodetestargument(to:)"
---

# encodeTestArgument(to:)

Encode this test argument.

## Declaration

```swift
func encodeTestArgument(to encoder: some Encoder) throws
```

## Parameters

- `encoder`: The encoder to write data to.

## Discussion

Discussion note: Any error encountered during encoding. The encoded form of a test argument should be stable and unique to allow re-running specific test cases of a parameterized test function. For optimal performance, large values which are not necessary to uniquely identify the test argument later should be omitted. Encoded values do not need to be human-readable. For more information on how to implement this function, see the documentation for Encodable.
