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.
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"}'
Run a shell command inside a service container. Great for database migrations, file preparation, or any CLI tool.
setup:
- cli:
service: app
command: bin/console migrations:migrate --no-interaction