Test(_:_:arguments:)
Declare a test parameterized over a collection of values.
Declaration
@attached(peer) macro Test<C>(_ displayName: String? = nil, _ traits: any TestTrait..., arguments collection: C) where C : Collection, C : Sendable, C.Element : SendableParameters
- 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.