Record और replay
ruby-anything app record <repo> --http --inputs rails/port/app-cases/inputs.jsonl \
--db-reset "<command that resets the test database>" -- <command that starts the original>
ruby-anything app replay <repo> --original # the original must pass its own recording 100%
Start command PORT पढ़ता है या {port} इस्तेमाल करता है (अगर port fixed है तो --port)। बिना
parameters वाले GET routes code से खोजे जाते हैं; बाकी सब inputs.jsonl से आता है
(हर line में {"name", "method", "path", "headers", "body"})।
हर case status, redirects, JSON और page text सेव करता है। हर GET दो बार चलता है: जो values
runs के बीच बदलती हैं, वे [..] wildcards बन जाती हैं।
Side effects
जो port card charge करना या receipt भेजना भूल जाए, उसे fail होना चाहिए:
ruby-anything app record <repo> --http --inputs ... \
--effect-env PAYMENT_API_URL=http,SMTP_HOST=smtp_host,SMTP_PORT=smtp_port \
--db-dump "sqlite3 db.sqlite3 .dump" --db-reset "<reset command>" -- <start command>
--effect-env NAME=KIND app की अपनी setting को एक local stand-in की ओर मोड़ देता है जो हर
call record करता है: http, smtp, smtp_host और smtp_port। --db-dump हर non-GET request के बाद चलता है,
और उसकी rows case का हिस्सा होती हैं। Replay Rails app के लिए वही variables set करता है, और Rails app को
भी उन्हें पढ़ना होगा।
CLI apps
ruby-anything app record <repo> --cli --inputs rails/port/app-cases/cli.jsonl -- python tool.py
Invocations को cli.jsonl में list करें ({"name", "args": [...], "stdin", "env"})। हर एक repo की एक
throwaway copy में दो बार चलता है; exit code, stdout, stderr और वह जो files लिखता है, यही case है।
Replay
ruby-anything app replay <repo> # every case through Rails
ruby-anything app replay <repo> --case <name> # one case
Pages की तुलना visible text से होती है, इसलिए markup नया है लेकिन हर heading, label, price और empty state फिर भी मौजूद होना चाहिए। JSON हूबहू मेल खाना चाहिए।