Group
  • Testing

    Test my background jobs and scheduled tasks

    Verify queued jobs, cron tasks, and retries actually run, handle failure, and don't pile up silently.

    • Improve quality
    • Automate workflows
    • Intermediate
    • General

Free Prompt

My app has background work: queued jobs, scheduled tasks, or cron jobs (emails, cleanups, syncs, report generation). I want tests proving they work, because they fail silently by design. First, inventory the background work: every job type, what triggers it, what it's supposed to do, and what happens today if it throws an error. Then write tests covering: 1. Each job does its actual work: enqueue it (or invoke it directly with fixture data) and assert the expected end state in the database or the mocked external service. 2. Failure handling: make the job throw and assert what happens. Does it retry? Does the failure get logged somewhere visible? Does a poison job block everything behind it in the queue? 3. Retry safety: if a job runs twice (retry after partial completion), the result is still correct, not doubled. 4. Scheduled jobs: verify each cron or scheduled task is registered with the schedule I expect, and that its logic runs correctly when invoked. Also flag any job with no failure visibility. A job that fails silently forever is worse than no job, because I believe work is happening that isn't. When finished, run the suite and give me the job inventory with per-job status: tested, retry behavior verified, and failure visibility (or its absence).

What This Does / How This Helps

This tests your background jobs and scheduled tasks: that they do their work, survive failure with retries and logging, and tolerate running twice. Background jobs are where silent failures live. A welcome email job that started throwing three weeks ago produces no errors you'd ever see, just a slow leak of confused users. Testing jobs means the leak gets caught in the suite, and the audit of failure visibility tells you whether a future failure would be findable at all.

Want to skip doing this by hand?

Fortivibe audits your app for all of the areas these prompts cover (and more).

See What We Check

Related Prompts