TestFlow Agent: Converting English and Web Traffic to API Tests
Natural Language to API Sequence
If you're testing your own service and already know the endpoints, you can skip the recording phase entirely. You just describe the flow in plain English:
Create an enrollment for a Texas member.
Get available plans for Texas. Select a Silver plan.
Submit enrollment with effective date 01/01/2026.
Validate enrollment status is ACTIVE.The agent parses the intent and maps it to the actual API sequence:
POST {{baseUrl}}/auth/token
POST {{baseUrl}}/members
GET {{baseUrl}}/plans?state=TX
POST {{baseUrl}}/enrollments
GET {{baseUrl}}/enrollments/{{enrollmentId}}It then outputs the Postman collection, Playwright spec, and JMeter plan. Since it includes a mock API, you can actually execute the flow end-to-end to verify the logic before deploying it to a real environment.
The Browser Discovery Mode
The more powerful side of this is the discovery mode, which requires zero prior knowledge of the API. You point the tool at a live URL, perform the actions manually in a browser, and it intercepts the network traffic to build the tests.
Turning raw browser logs into a stable AI workflow is harder than it looks because web traffic is noisy. To make these tests actually runnable, I had to implement a few specific logic layers:
- Dynamic Variable Chaining: It detects IDs and tokens in responses and automatically injects them into subsequent requests.
- Semantic Naming: It maps variables based on JSON fields (e.g.,
employee.idbecomesemployeeId) rather than unreliable URL strings. - Token Refresh: Instead of hardcoding stale CSRF tokens that cause 403 errors, it configures the test to fetch a fresh token during the login sequence.
- Noise Filtering: It strips out analytics, fonts, and tracking pixels so you only see the business-critical API calls.
- Token Matching: It uses whole-token matching to ensure a short ID (like
7) doesn't accidentally overwrite part of a larger number (like4700).
This essentially turns a manual walkthrough into a complete guide of API tests without having to manually inspect the Network tab for an hour.
https://github.com/sshankar07/test-flow-agent