<!--
{
  "availability" : [
    "Xcode: 16.0.0 -",
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "swift: 6.0.0 -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Testing",
  "identifier" : "/documentation/Testing/Test(_:_:arguments:)-8kn7a",
  "metadataVersion" : "0.1.0",
  "role" : "Macro",
  "symbol" : {
    "kind" : "Macro",
    "modules" : [
      "Swift Testing"
    ],
    "preciseIdentifier" : "s:7Testing4Test__9argumentsySSSgYt_AA0B5Trait_pdxtcSlRzs8SendableRzsAF7ElementRpzlufm"
  },
  "title" : "Test(_:_:arguments:)"
}
-->

# Test(_:_:arguments:)

Declare a test parameterized over a collection of values.

```
@attached(peer) macro Test<C>(_ displayName: String? = nil, _ traits: any TestTrait..., arguments collection: C) where C : Collection, C : Sendable, C.Element : Sendable
```

## Parameters

`displayName`

The customized display name of this test. If the value of
this argument is `nil`, the display name of the test is derived from the
associated function’s name.

`traits`

Zero or more traits to apply to this test.

`collection`

A collection of values to pass to the associated test
function.

## Overview

You can prefix the expression you pass to `collection` with `try` or `await`.
The testing library evaluates the expression lazily only if it determines
that the associated test will run. During testing, the testing library calls
the associated test function once for each element in `collection`.

## See Also

[Defining test functions](/documentation/Testing/DefiningTests)

Define a test function to validate that code is working correctly.



---

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)