Setup

Sometimes your test needs the world to look a certain way before it runs. A database with seed data, a cleared cache, a test user already created. That's what setup steps are for.

Setup runs after services start and pass their health checks, but before the actual test execution. If your test doesn't need any preparation, just skip this section entirely.

setup:
  - http:
      target: http://api:8080
      request:
        method: POST
        url: /api/seed
        body: '{"fixtures": "users"}'

  - cli:
      service: app
      command: bin/console cache:clear

Steps run sequentially in the order you define them. If any step fails, the test is marked as failed — Spark won't run the execution or assertions.

Mix and match freely. You can combine HTTP and CLI steps in any order. Call a seed endpoint, then run a migration, then clear a cache — whatever your test needs.

Call an API endpoint on one of your services. Great for seeding data, triggering preparation logic, or calling any HTTP-accessible endpoint.

setup:
  - http:
      target: http://api:8080
      request:
        method: POST
        url: /api/seed
        body: '{"fixtures": "users"}'

Full HTTP setup reference →