# How to Run Tests in Palmier Pro: A Complete Swift Testing Guide

> Learn how to run tests in Palmier Pro with our comprehensive Swift testing guide. Execute the full suite on macOS by running swift test from your repository root.

- Repository: [Palmier/palmier-pro](https://github.com/palmier-io/palmier-pro)
- Tags: how-to-guide
- Published: 2026-06-22

---

**Run `swift test` from the repository root after resolving dependencies and building the project to execute the full Swift Testing suite on macOS 26.**

Palmier Pro uses the modern Swift Testing framework for its unit tests, defined in the `PalmierProTests` target within [`Package.swift`](https://github.com/palmier-io/palmier-pro/blob/main/Package.swift). Running these tests locally ensures your development environment matches the GitHub Actions CI pipeline, which automatically validates every push against the macOS 26 SDK. This guide covers the exact commands and architecture you need to execute tests reliably on any Apple Silicon Mac.

## Prerequisites

Before you can run tests in Palmier Pro, verify your development environment meets the following requirements:

- **Swift 6.2**: The test suite requires the Swift 6.2 toolchain shipped with macOS 26.
- **macOS 26 SDK**: Tests must run on macOS 26 (Sequoia) or later to match the CI environment.
- **Git**: Required for cloning the repository.

Check your Swift version:

```bash
swift --version

```

The output should report Swift 6.2. The CI workflow in [`.github/workflows/ci.yml`](https://github.com/palmier-io/palmier-pro/blob/main/.github/workflows/ci.yml) also prints this version before building to ensure consistency.

## Step-by-Step: How to Run Tests in Palmier Pro

Follow these commands to clone, build, and test the project from source.

### 1. Clone the Repository

```bash
git clone https://github.com/palmier-io/palmier-pro.git
cd palmier-pro

```

### 2. Resolve Package Dependencies

The project uses Swift Package Manager to fetch third-party libraries like `DSWaveformImage`, `Sparkle`, and `Lottie`.

```bash
swift package resolve

```

This command reads [`Package.swift`](https://github.com/palmier-io/palmier-pro/blob/main/Package.swift) and downloads all required dependencies.

### 3. Build the Project

Compile the main executable target before running tests:

```bash
swift build

```

This step mirrors the CI pipeline, which runs `swift build` before testing to ensure the target compiles cleanly.

### 4. Execute the Test Suite

Run the full test suite using Swift Testing:

```bash
swift test

```

This command discovers and executes all tests in `Tests/PalmierProTests`, including [`SmokeTests.swift`](https://github.com/palmier-io/palmier-pro/blob/main/SmokeTests.swift) and [`TimeFormattingTests.swift`](https://github.com/palmier-io/palmier-pro/blob/main/TimeFormattingTests.swift). A successful run ends with `Test Succeeded`, while failures provide file and line numbers for debugging.

## Running Specific Tests

For faster iteration during development, you can filter tests by name rather than running the entire suite:

```bash
swift test --filter SmokeTests

```

This executes only the tests defined in [`Tests/PalmierProTests/SmokeTests.swift`](https://github.com/palmier-io/palmier-pro/blob/main/Tests/PalmierProTests/SmokeTests.swift), which contains a simple sanity check confirming basic timeline logic. Use this approach when debugging individual components like the `TimeFormatting` utility.

## Understanding the Test Architecture

Palmier Pro's testing setup follows Swift Package Manager conventions with modern Swift Testing APIs.

### Test Target Configuration

In [`Package.swift`](https://github.com/palmier-io/palmier-pro/blob/main/Package.swift) (lines 49-55), the manifest declares a dedicated test target:

```swift
// Simplified representation based on Package.swift structure
.testTarget(
    name: "PalmierProTests",
    dependencies: ["PalmierPro"]
)

```

This configuration allows test files to use `@testable import PalmierPro` to access internal application code.

### Swift Testing Framework

Unlike older XCTest-based projects, Palmier Pro uses the Swift Testing API introduced with Swift 6. Tests are structured as:

- **`@Suite` structs**: Group related test cases
- **`@Test` methods**: Define individual test functions
- **`#expect` macros**: Provide type-safe assertions

For example, [`Tests/PalmierProTests/TimeFormattingTests.swift`](https://github.com/palmier-io/palmier-pro/blob/main/Tests/PalmierProTests/TimeFormattingTests.swift) exercises [`Sources/PalmierPro/Utilities/TimeFormatting.swift`](https://github.com/palmier-io/palmier-pro/blob/main/Sources/PalmierPro/Utilities/TimeFormatting.swift) using these modern constructs.

### CI Integration

The [`.github/workflows/ci.yml`](https://github.com/palmier-io/palmier-pro/blob/main/.github/workflows/ci.yml) workflow automates testing on every push:

1. Runs on a macOS 26 runner
2. Executes `swift --version` to verify the toolchain
3. Runs `swift build` to compile the project
4. Executes `swift test` to validate functionality

This ensures that local test runs using the same commands produce identical results to the CI environment.

## Summary

Running tests in Palmier Pro requires only standard Swift Package Manager commands, but depends on specific macOS and Swift versions:

- Use **Swift 6.2** on **macOS 26** to match the CI environment
- Execute `swift package resolve` and `swift build` before testing
- Run `swift test` to execute the full `PalmierProTests` suite
- Filter specific tests with `swift test --filter <TestName>`
- Test code resides in `Tests/PalmierProTests/` and uses modern Swift Testing (`@Suite`, `@Test`, `#expect`)

## Frequently Asked Questions

### What Swift version is required to run tests in Palmier Pro?

Palmier Pro requires **Swift 6.2**, which ships with the macOS 26 SDK. Running `swift --version` in your terminal should report version 6.2 before you attempt to build or test. The CI workflow explicitly checks this version to prevent mismatches between local and automated test runs.

### How do I run only one test file instead of the full suite?

Use the `--filter` flag with the `swift test` command. For example, `swift test --filter SmokeTests` runs only the tests defined in [`Tests/PalmierProTests/SmokeTests.swift`](https://github.com/palmier-io/palmier-pro/blob/main/Tests/PalmierProTests/SmokeTests.swift). This approach saves time when debugging specific functionality like timeline rendering or time formatting utilities.

### Where are the test targets defined in the Palmier Pro repository?

The test target `PalmierProTests` is declared in [`Package.swift`](https://github.com/palmier-io/palmier-pro/blob/main/Package.swift) at lines 49-55. This manifest entry specifies the test target's dependencies on the main `PalmierPro` executable target, enabling access to internal modules via `@testable import` statements in the test code.

### Does Palmier Pro use XCTest or Swift Testing?

Palmier Pro uses the modern **Swift Testing** framework (not XCTest). Tests are written using `@Suite` and `@Test` decorators with `#expect` macros for assertions, as seen in [`Tests/PalmierProTests/TimeFormattingTests.swift`](https://github.com/palmier-io/palmier-pro/blob/main/Tests/PalmierProTests/TimeFormattingTests.swift). This requires Swift 6.2 and provides type-safe, expressive test definitions compared to the older XCTest API.