Testing Guide
This guide shows how to test the e-commerce workflow and demonstrate its reliability features.
Quick Start
Set up the example:
cd /path/to/your/rails/app
./setup.shLoad sample data:
rails runner 'SampleDataSetup.setup_all'Start background jobs:
bundle exec sidekiqTesting Scenarios
1. Successful Checkout Flow
Test a normal, successful checkout:
curl -X POST http://localhost:3000/checkout \
-H "Content-Type: application/json" \
-d '{
"checkout": {
"cart_items": [
{"product_id": 1, "quantity": 2},
{"product_id": 3, "quantity": 1}
],
"payment_info": {
"token": "test_success_visa_4242424242424242",
"amount": 294.97
},
"customer_info": {
"email": "[email protected]",
"name": "Test Customer",
"phone": "555-123-4567"
}
}
}'Expected response:
2. Payment Failure with Retry
Test payment failure scenarios:
3. Inventory Conflict Scenario
Test what happens when inventory changes during checkout:
Monitoring Workflow Execution
Check Task Status
Possible responses:
{"status": "processing", "current_step": "process_payment", "progress": {...}}{"status": "completed", "order_id": 123, "order_number": "ORD-20241215-ABC123"}{"status": "failed", "error": "Payment declined", "failed_step": "process_payment"}
View Detailed Workflow Information
This shows complete step-by-step execution details:
Retry Failed Workflows
Rails Console Testing
For more detailed testing, use the Rails console:
Testing Retry Logic
Simulate different failure scenarios and observe retry behavior:
Performance Testing
Test the workflow under load:
Error Scenarios and Expected Behavior
Payment gateway timeout
Retry 3 times with exponential backoff
Automatic
Insufficient funds
Fail immediately (non-retryable)
Manual customer action
Inventory out of stock
Retry 3 times in case of race conditions
Automatic or manual
Email delivery failure
Retry 5 times over increasing intervals
Automatic
Database connection lost
Retry with connection recovery
Automatic
Invalid payment token
Fail immediately (non-retryable)
Manual token refresh
Observing Retry Patterns
Watch retry behavior in real-time:
Debugging Failed Workflows
When workflows fail, use these techniques to understand what happened:
This testing guide helps you understand how Tasker's reliability features work in practice and gives you confidence that your workflows will handle real-world failure scenarios gracefully.
Last updated