---
title: "init(invocation:)"
framework: xctest
role: symbol
role_heading: Initializer
path: "xctest/xctestcase/init(invocation:)"
---

# init(invocation:)

Initializes a test case with an invocation.

## Declaration

```swift
init(invocation: NSInvocation?)
```

## Parameters

- `invocation`: An invocation to use when running this test.

## See Also

### Creating Tests Programmatically

- [init(selector:)](xctest/xctestcase/init(selector:).md)
- [testInvocations](xctest/xctestcase/testinvocations.md)
- [invocation](xctest/xctestcase/invocation.md)
- [invokeTest()](xctest/xctestcase/invoketest().md)
- [record(_:)](xctest/xctestcase/record(_:).md)
- [recordFailure(withDescription:inFile:atLine:expected:)](xctest/xctestcase/recordfailure(withdescription:infile:atline:expected:).md)
- [defaultTestSuite](xctest/xctestcase/defaulttestsuite.md)
