---
title: "test(_:parameters:)"
framework: swift-package-manager
role: symbol
role_heading: Instance Method
path: "swift-package-manager/documentation/packageplugin/packagemanager/test(_:parameters:)"
---

# test(_:parameters:)

Runs all, or a specified subset, of the unit tests of the package, after an incremental build if necessary.

## Declaration

```swift
func test(_ subset: PackageManager.TestSubset, parameters: PackageManager.TestParameters) throws -> PackageManager.TestResult
```

## Parameters

- `subset`: The subset of tests to run.
- `parameters`: The test parameters to apply.

## Return Value

Return Value The test results.

## Discussion

Discussion The is functionally the same as swift test on the command line. The returned test result includes any test failures. This method throws an error if the input parameters are invalid, or if the test cannot be started. The Swift package manager command-line interface, or any IDE, may show the progress of the tests as they happen.

## See Also

### Testing a Package

- [PackageManager.TestSubset](swift-package-manager/documentation/packageplugin/packagemanager/testsubset.md)
- [PackageManager.TestParameters](swift-package-manager/documentation/packageplugin/packagemanager/testparameters.md)
- [PackageManager.TestResult](swift-package-manager/documentation/packageplugin/packagemanager/testresult.md)
