# Run tests on macOS
test-macos:
  stage: test
  extends: .macos_saas_runners
  needs: ["testpilot-install-macos"]
  script:
    - ./bin/testpilot test tests/
```

## Sharding your Tests and Running in Parallel[​](#sharding-your-tests-and-running-in-parallel "Direct link to Sharding your Tests and Running in Parallel")

Testpilot can shard your test files across multiple runners using the `--shard` flag, which is
useful for parallelizing and speeding up your test runs. Note that after sharding and running your
tests in parallel, you will probably want to merge the reports back together using
`testpilot report merge`.

You can see an example of sharding testpilot files in our
[example repo](https://gitlab.com/jetify-com/gitlab-components-example). An example gitlab.yaml file
is below:

```yaml theme={null}
include:
  - component: gitlab.com/jetify-com/gitlab-components/testpilot-install@main
    inputs:
      stage: install
      xdg_cache_home: .cache/jetify

stages:
  - install
  - test
  - merge

testpilot-test:
  stage: test
  needs: ["testpilot-install-linux-amd64"]
  parallel: 2
  # Use built in CI_NODE environment variables to shard across runners
  script: ./bin/testpilot test --outdir=testpilot-out-${CI_NODE_INDEX} --shard=${CI_NODE_INDEX}/${CI_NODE_TOTAL} --reporters=junit
  artifacts:
    reports:
      junit: testpilot-out/*.xml
    paths:
      - testpilot-out-${CI_NODE_INDEX}/
    when: always
    expire_in: 1 week