> ## Documentation Index
> Fetch the complete documentation index at: https://plugwright.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Test Filtering

> Run specific tests using `-PtestFiles` and `-PtestNames`.

### Syntax Rules

* **Matching:** Case-sensitive substring matching.
* **Multiple Patterns:** Comma-separated (no spaces).
* **Extensions:** No need to include `.spec.js` or `.spec.ts`.

## Filter by File

Run specific test files.

```bash theme={null}
# Run basic.spec.js
./gradlew plugwrightTest -PtestFiles="basic"

# Run files matching "basic" OR "commands"
./gradlew plugwrightTest -PtestFiles="basic,commands"
```

## Filter by Test Name

Run specific test cases.

```bash theme={null}
# Run tests containing "should connect"
./gradlew plugwrightTest -PtestNames="should connect"

# Run tests matching "teleport" OR "spawn"
./gradlew plugwrightTest -PtestNames="teleport,spawn"
```

## Combine Filters

Run tests that match **both** the file and the name criteria.

```bash theme={null}
# Run "purchase" tests, but only inside "shop" files
./gradlew plugwrightTest -PtestFiles="shop" -PtestNames="purchase"
```

<Tip>
  **Note:** Running `./gradlew plugwrightTest` without arguments runs all tests.
</Tip>
