Back to Prompts
Coding Assistant

Build a Test That Catches Race Conditions

Race conditions hide in testing. This flushes them out From the Race Conditions AI Coding Building Block.

Prompt
I want to test whether my [feature, e.g. token redemption / inventory checkout / balance deduction] is vulnerable to race conditions before I launch.

Build a simple test script or admin tool that:
- Simulates [10-50] users hitting the same [endpoint / action] at the exact same time
- Targets a shared resource like [a coupon with 1 use left / an item with limited stock / a user balance]
- Logs the result of every request (success or failure)
- Checks the final database state against what it should be (e.g. balance should never go negative, stock should never go below zero)
- Clearly reports if the race condition was triggered

My stack: [your language and framework here]

I'm learning, so explain each part simply.
1 views 0 copies