View all services
Talk to QA Advisor
Browse the Knowledge Hub74 resources
/Test Cases/Background job and queue test cases

Test cases

Queue test cases, for the job that runs twice

Twenty eight cases covering at-least-once delivery and idempotent handlers, work outliving the visibility timeout, worker death mid job, poison messages and dead letter replay, backlog bounds, priority starvation, scheduler overlap across instances, enqueue before commit and graceful drain on deploy.

28cases/8coverage types/10state cases/FreeCSV download

All 28 test cases, ready to copy

Free to use and adapt, no sign-up. Download as CSV or Markdown, or copy it straight into your own tooling.

Last updated

28 worked examples

JOB-01

Process a queued job successfully

TypeFunctionalPriorityHigh
Test data
A single valid message consumed by one worker
Expected result
Work completes, the message is acknowledged and removed, and the outcome is recorded with enough detail to trace it later.
JOB-02

Run the handler twice without doubling the effect

TypeStatePriorityHigh
Test data
Deliver the same message twice to the handler
Expected result
Side effects happen once. Queues are at-least-once by design, so a handler that is not idempotent will double charge, double email or double post.
JOB-03

Handle work that outlives the visibility timeout

TypeBoundaryPriorityHigh
Test data
A job taking longer than the configured visibility or lock timeout
Expected result
Lock is extended while work continues, or the handler is safe to run concurrently. Otherwise the message reappears and a second worker starts the same job.
JOB-04

Recover a message when a worker dies mid job

TypeStatePriorityHigh
Test data
Kill the worker process partway through processing
Expected result
Message returns to the queue and is retried rather than lost, and any partial work is either rolled back or safely resumable.
JOB-05

Retry a failed job with backoff

TypeStatePriorityHigh
Test data
A handler throwing on the first two attempts then succeeding
Expected result
Retries follow the documented schedule with backoff and jitter, and the attempt count is visible rather than hidden in logs.
JOB-06

Move a poison message to a dead letter queue

TypeNegativePriorityHigh
Test data
A message that fails deterministically on every attempt
Expected result
Moved to a dead letter queue after the maximum attempts. Without one, a single bad message retries forever and blocks throughput behind it.
JOB-07

Inspect and replay a dead lettered message

TypeStatePriorityHigh
Test data
A dead lettered message replayed after the underlying bug is fixed
Expected result
Original payload and failure reason are both readable, and replay processes it exactly once without duplicating the partial effects of earlier attempts.
JOB-08

Keep the backlog bounded and visible

TypePerformancePriorityHigh
Test data
Enqueue faster than the consumer rate for a sustained period
Expected result
Queue depth and oldest message age are both monitored and alertable, and the backlog drains at a measured rate once input returns to normal.
JOB-09

Prevent priority starvation

TypeBoundaryPriorityHigh
Test data
A flood of high priority messages alongside low priority ones
Expected result
Low priority work still progresses within a stated bound rather than waiting indefinitely behind an endless stream of higher priority messages.
JOB-10

Isolate one slow job type from the rest

TypePerformancePriorityHigh
Test data
A slow job type sharing a worker pool with fast ones
Expected result
Fast jobs continue to be processed. A single slow type consuming every worker is the most common cause of an apparently stalled queue.
JOB-11

Skip or queue an overlapping scheduled run

TypeBoundaryPriorityHigh
Test data
A scheduled job whose run takes longer than its interval
Expected result
Second run is skipped or queued rather than running concurrently, and no work is processed twice as a result of the overlap.
JOB-12

Run a scheduled job once across multiple instances

TypeBoundaryPriorityHigh
Test data
Three application instances all holding the same schedule
Expected result
Exactly one instance runs it, enforced by a lock rather than by configuration, since scaling out otherwise multiplies every scheduled job.
JOB-13

Schedule against the correct timezone

TypeBoundaryPriorityHigh
Test data
A daily job across a daylight saving transition
Expected result
Runs once on the skipped hour day and once on the repeated hour day, according to a documented rule rather than by accident of server timezone.
JOB-14

Catch up or skip missed runs after downtime

TypeStatePriorityMedium
Test data
The scheduler offline across three scheduled executions
Expected result
Documented behaviour applied consistently, and a catch up does not fire three runs simultaneously in a way the downstream cannot absorb.
JOB-15

Enqueue only after the transaction commits

TypeStatePriorityHigh
Test data
Enqueue a job inside a transaction that then rolls back
Expected result
No job runs. Enqueuing before commit means a worker can pick up the message and find the record it references does not exist.
JOB-16

Handle a job whose target record no longer exists

TypeNegativePriorityHigh
Test data
Delete the referenced record between enqueue and processing
Expected result
Handler exits cleanly with a recorded reason rather than throwing and retrying to the dead letter queue on a condition that will never resolve.
JOB-17

Cancel a queued job

TypeStatePriorityMedium
Test data
Cancel a job while queued, then attempt to cancel one already running
Expected result
Queued job is cancelled with no effect. A running job either supports cooperative cancellation or reports plainly that it cannot be stopped.
JOB-18

Deduplicate identical jobs enqueued in quick succession

TypeBoundaryPriorityHigh
Test data
The same logical job enqueued five times within a second
Expected result
Collapsed to one according to a documented deduplication key, so a rapid sequence of user actions does not queue five identical exports.
JOB-19

Handle a batch job with per item failures

TypeNegativePriorityHigh
Test data
A batch of 500 items where 12 fail
Expected result
Successful items are committed, failures are recorded individually with a reason, and the batch is not retried wholesale in a way that reprocesses the successes.
JOB-20

Resume a long job safely after interruption

TypeStatePriorityHigh
Test data
Interrupt a long running job at 60 per cent and restart it
Expected result
Resumes from durable progress rather than restarting, and reprocessing an already completed portion produces no duplicate effect.
JOB-21

Drain the queue gracefully on deployment

TypeStatePriorityHigh
Test data
Deploy while jobs are in flight
Expected result
In flight jobs finish or are returned to the queue cleanly within the shutdown grace period, and none is killed midway leaving partial state.
JOB-22

Process a message enqueued by an older application version

TypeCompatibilityPriorityHigh
Test data
A payload written by the previous release consumed by the new one
Expected result
Parsed correctly or routed for handling. During any rolling deploy both versions coexist, so payload changes must be backward compatible.
JOB-23

Reject an oversized or malformed message

TypeNegativePriorityMedium
Test data
A payload above the broker size limit and one that fails to deserialise
Expected result
Refused at enqueue where possible, and a malformed message goes straight to the dead letter queue rather than crash looping a worker.
JOB-24

Keep large payloads out of the message body

TypePerformancePriorityMedium
Test data
A job operating on a large document or file
Expected result
Message carries a reference rather than the content, so queue throughput and storage are not driven by payload size.
JOB-25

Handle a downstream dependency failing mid job

TypeStatePriorityHigh
Test data
Make a required external service fail partway through a handler
Expected result
Job fails cleanly and retries, no partial state is committed, and repeated dependency failure does not fill the dead letter queue within minutes.
JOB-26

Scope every job to its tenant

TypeSecurityPriorityHigh
Test data
A job payload carrying an identifier belonging to another tenant
Expected result
Refused. A worker runs without a user session, so authorisation has to be re-established from the payload rather than assumed.
JOB-27

Keep sensitive data out of payloads and logs

TypeSecurityPriorityHigh
Test data
Inspect message bodies at rest and worker logs after a failure
Expected result
No credential or unnecessary personal data is present, and payloads are subject to the same retention rules as the records they reference.
JOB-28

Trace a job from enqueue to completion

TypeStatePriorityHigh
Test data
One job followed through the request that enqueued it, its attempts and its outcome
Expected result
A correlation identifier links all of them, so a failure can be traced back to the originating request without guessing from timestamps.

What goes in each field

ID

Required

Stable identifier, prefixed by module.

Test case

Required

What is being verified, in one line.

Type

Functional, negative, boundary, security, state, performance, accessibility or compatibility. Use it to check coverage is spread rather than clustered on the happy path.

Priority

Risk based. Anything that runs a side effect twice, loses a message, or lets a backlog grow without bound is High. Poison message handling is High because one bad message can stall an entire queue.

Test data

The specific values, including the invalid and boundary ones.

Expected result

Required

The precise observable outcome, including message text where the wording itself is the requirement.

How To Use This

Make the job outlast its lock

One message consumed by one worker is the path that always works. These four conditions are where side effects double or queues stall.

Run longer than the visibility timeout

The message reappears, a second worker picks it up, and the job runs twice while the first is still going. This is the single most common source of duplicate side effects.

Feed it a message that always fails

Without a dead letter queue, one bad message retries forever and blocks throughput behind it. The queue looks alive and nothing is getting through.

Scale to three instances

If each holds the same schedule and there is no lock, every scheduled job now runs three times. Scaling out silently multiplies every cron in the system.

Roll back after enqueuing

Enqueue inside a transaction, then roll back. The worker picks up a message referencing a record that does not exist, and fails on a condition that will never resolve.

What Most Sets Miss

Why queue defects double the work

Every mainstream queue is at-least-once, which means duplicate delivery is a normal operating condition rather than a fault. The handler is therefore the place where exactly-once has to be constructed, and it is constructed by making the side effect idempotent. A handler that charges a card, sends an email or posts to a ledger without a deduplication key will do it twice in production, and the trigger is usually not an exotic failure: it is simply a job that took longer than its visibility timeout, so the broker concluded the worker had died and handed the message to somebody else while the original was still running.

Poison messages are the failure that stalls a queue while every dashboard says it is healthy. A message that fails deterministically will be retried forever without a dead letter queue, consuming a worker and blocking whatever is behind it. The dead letter queue is only half the fix: it also needs to be inspectable and replayable, because otherwise the failed messages accumulate somewhere nobody looks and the events they represent are quietly lost.

Scheduling breaks the moment you scale out. Three application instances each holding the same cron definition will run every scheduled job three times unless a lock enforces single execution, and this is invisible in a single instance environment. The neighbouring cases are overlap, where a run that takes longer than its interval starts concurrently with itself, and timezone, where a daily job across a daylight saving transition either runs twice or not at all.

Finally, two ordering problems that look unrelated and are the same mistake. Enqueuing inside a transaction that later rolls back sends a worker after a record that does not exist. And deploying while jobs are in flight kills them midway unless the shutdown grace period returns them to the queue cleanly. Both come from treating the queue as though it were inside your transaction boundary when it is emphatically outside it.

Suggest an improvement

Testing an async or event driven system?

QAble tests background processing end to end, including idempotency under redelivery, dead letter behaviour, scheduler correctness across instances and drain on deploy.

DevOps automation services

More test case sets

View all

Test cases for a login page

Test cases
25 cases across functional, negative, boundary, security, session and accessibility paths, including account enumeration and lockout.

Test cases for a registration form

Test cases
28 cases covering validation, duplicate accounts, email verification, password rules and the enumeration leak most signup forms ship with.

Test cases for search functionality

Test cases
28 cases across relevance, partial and fuzzy matching, filters, pagination, empty states, injection attempts and performance under load.

Test cases for a shopping cart

Test cases
27 cases on quantity limits, price recalculation, stock changes, coupon stacking, guest to account merge and cart persistence.

Test cases for checkout and payment

Test cases
30 cases including 3D Secure, declines, timeouts, duplicate charges, idempotency, refunds and partial captures.

Test cases for file upload

Test cases
28 cases on size and type limits, spoofed content types, malicious filenames, progress, resume, virus scanning and storage limits.

Test cases for forgot password

Test cases
26 cases on reset token expiry, single use enforcement, session invalidation and the enumeration and rate limit gaps that are routine here.

Test cases for OTP verification

Test cases
26 cases on expiry, resend throttling, attempt limits, code reuse, delivery failure and the brute force window teams forget to close.

Test cases for user roles and permissions

Test cases
26 cases on horizontal and vertical privilege checks, direct object access, role changes mid-session and permission inheritance.

Test cases for form validation

Test cases
27 rules-based cases on required fields, length and numeric boundaries, client and server parity, hidden field tampering and error accessibility.

Test cases for a date picker

Test cases
26 cases on timezone shifts, ambiguous day and month order, impossible dates, min and max limits, leap years and keyboard operation.

Test cases for pagination

Test cases
24 cases on ordering stability, records changing mid-session, page size caps, deep offset cost, permission-filtered totals and state restore.

Test cases for push notifications

Test cases
26 cases on app states, deep link routing, token release on sign out, lock screen privacy, preferences, provider failures and platform differences.

Test cases for reports and data export

Test cases
25 cases on permission filtering in the file, spreadsheet formula injection, encoding, typed numbers and dates, row limits and audit logging.

Test cases for a chatbot

Test cases
28 cases on paraphrased intents, context, fallback loops, human handoff, policy grounding, prompt injection and data scoping.

Test cases for net banking transactions

Test cases
28 cases on duplicate debits from a retried request, concurrent transfers against one balance, daily limits across channels, beneficiary cooling periods, second factor binding and reconciliation.

Test cases for wallet and UPI payments

Test cases
28 cases on payments that time out with no response, idempotency on retry, racing balances, caps across devices, collect request fraud, mandates and refunds.

Test cases for insurance claim submission

Test cases
28 cases on coverage at the date of loss, waiting periods, deductibles and sub limits, exclusions and riders, duplicate claims and settlement reconciliation.

Test cases for patient records in an EHR

Test cases
28 cases on duplicate detection and merge, wrong patient entry, units of measure, allergy and interaction alerting, break glass access and audit of reads.

Test cases for CRM lead management

Test cases
28 cases on duplicate leads under concurrency, routing and the unrouted fallback, round robin races, territory visibility, conversion and bulk import.

Test cases for an ERP purchase order

Test cases
28 cases on approval thresholds, amendments that must reset approval, budget commitment races, over receipt tolerance, three-way match and duplicate invoices.

Test cases for OTT video playback

Test cases
28 cases on bitrate recovery after a dip, DRM renewal mid stream, concurrent stream limits and leaked slots, resume conflicts, ad cue points and offline expiry.

Test cases for game level progression

Test cases
28 cases on save corruption during a crash write, cloud save conflicts, offline queue replay, unlock gating, currency exploits and purchase restore.

Test cases for a REST API

Test cases
28 cases on status code correctness, cross tenant resource access, mass assignment, idempotent retries, cursor pagination, rate limits and contract drift.

Test cases for SSO and social login

Test cases
28 cases on linking an account on an unverified email, state and code replay, redirect allow lists, token signature and issuer, deprovisioning and session rotation.

Test cases for subscription and billing

Test cases
28 cases on mid cycle proration, duplicate and out of order webhooks, renewal double charges, dunning and grace, trials, coupons, metered usage and tax.

Test cases for data tables, filters and sorting

Test cases
28 cases on unstable sorts across pages, filters that must reset pagination, selection surviving a filter change, bulk action scope and export fidelity.

Test cases for session timeout and concurrent login

Test cases
28 cases on tokens that survive sign out, refresh token reuse, idle against absolute lifetime, multi tab expiry, session limits and remote revocation.

Test cases for a multi step form wizard

Test cases
28 cases on values lost to back navigation, refresh and session expiry, step skipping, server side revalidation, duplicate submission and conditional branches.

Test cases for email verification

Test cases
28 cases on token reuse and expiry, invalidating earlier links, account enumeration, header injection, safe address change and mail scanner prefetching.

Test cases for dashboards and analytics widgets

Test cases
28 cases on reconciling against source rows, widgets that disagree, timezone aggregation, zero baselines, no data shown as zero and permission leaks in aggregates.

Test cases for booking and reservation

Test cases
28 cases on concurrent bookings for the last slot, inventory holds that leak, payment without a booking, cancellation boundaries and channel sync.

Test cases for mobile app install and update

Test cases
28 cases on migration chains across skipped versions, crashes during post upgrade migration, forced update lockouts, deep links and clean reinstall.

Test cases for accessibility (WCAG 2.2 AA)

Test cases
28 cases on keyboard only completion, focus management, live region announcements, contrast, reflow at 320 pixels, target size and screen reader verification.

Test cases for performance and load

Test cases
28 cases on spikes with no ramp, recovery after peak, soak and leak detection, pool exhaustion, cold caches, retry storms and data correctness under load.

Test cases for the OWASP Top 10

Test cases
28 cases on broken access control, mass assignment, injection across every input surface, credential stuffing, session invalidation, SSRF and exposed secrets.

Test cases for cross browser compatibility

Test cases
28 cases on storage that throws in private mode, blocked third party cookies, engine date parsing, mobile viewport units, in app browsers and ad blockers.

Test cases for database and data integrity

Test cases
28 cases on uniqueness under concurrency, lost updates, counter races, orphaned rows, migration and backfill safety, replica lag and verified restores.

Test cases for localisation and multi language support

Test cases
28 cases on text expansion, concatenated sentences, plural rules, locale date parsing, decimal separators, right to left layout, collation and encoding.

Test cases for outbound webhooks

Test cases
28 cases on retry backoff and dead letter stores, one dead consumer degrading the pipeline, payload signing and replay windows, out of order delivery and endpoint SSRF.

Test cases for real time features and websockets

Test cases
28 cases on messages lost in the reconnect gap, half open connections, per channel authorisation, tokens expiring mid connection, backpressure and fanout across instances.

Test cases for file storage and media processing

Test cases
28 cases on signed URL scope and expiry, serving before scanning completes, content type sniffing, metadata stripping, orphaned objects and derivative failures.

Test cases for CSV import and bulk operations

Test cases
28 cases on reruns duplicating successes, delimiters inside quoted fields, byte order marks, leading zeros, ambiguous dates and bulk action scope.

Test cases for feature flags and progressive rollout

Test cases
28 cases on unreachable flag services, unstable bucketing, rollouts that reshuffle users, kill switch latency, server and client mismatch and stale flags.

Test cases for Android app lifecycle and permissions

Test cases
28 cases on state lost to process death, configuration changes, permanent permission denial, revocation while backgrounded, doze and battery restrictions.

Test cases for iOS app lifecycle and permissions

Test cases
28 cases on the keychain surviving uninstall, suspended termination, limited photo access, allow once location, app switcher snapshots and biometric invalidation.

Test cases for wearable app sync

Test cases
28 cases on data recorded away from the phone, duplicate records on resync, full buffers, clock drift, health permissions, battery budgets and unworn readings.

Test cases for VR and AR experiences

Test cases
28 cases on the frame rate comfort floor, tracking loss, guardian boundaries, involuntary camera movement, AR anchor drift and spatial data privacy.

Test cases for IoT device pairing and telemetry

Test cases
28 cases on offline buffering and reconnect floods, fleet wide reconnection storms, shared credentials, wrong device clocks and stale queued commands.

Test cases for embedded firmware update

Test cases
28 cases on power loss mid write, automatic rollback and health confirmation, signature and anti rollback checks, staged rollouts and recovery mode.

Test cases for user profile and account settings

Test cases
28 cases on partial saves reported as success, optimistic updates the server rejected, mass assignment through a profile form, avatar content inspection and session invalidation.

Test cases for account deletion and data export

Test cases
28 cases on export links that must be authorised and expiring, deletion cascading to storage, caches, logs and processors, grace periods, legal holds and deadlines.

Test cases for consent and cookie management

Test cases
28 cases on cookies and tracking requests firing before consent, reject parity with accept, tag manager bypass, withdrawal, cached banners and server side forwarding.

Test cases for notification preferences and delivery

Test cases
28 cases on opt outs honoured on one channel and ignored on another, marketing sent as transactional, unsubscribe scope, imports resetting consent and digest timezones.

Test cases for admin impersonation and support access

Test cases
28 cases on actions attributed to the customer instead of the admin, credential exposure, chained and upward impersonation, session expiry and immutable access records.

Test cases for audit logs and activity history

Test cases
28 cases on forged entries through log injection, immutability and tamper detection, actor attribution across impersonation and jobs, retention and legal holds.

Want your async pipeline proven, not assumed?

QAble covers functional, state and concurrency paths with ISTQB-certified engineers. Start with a free QA audit of your platform.

Talk to QA Advisor