Blog
How to turn UI test traffic into API tests
Every UI test already exercises your API: each click that saves or loads data sends a request from the browser. If you capture those requests during a test run, you can replay them as API tests without writing them by hand. SmartestQA does this from the runs you already have.
The problem
Checks at the API level run faster than checks through the browser, break less often, and point more directly at the failing service. In practice a suite is often top-heavy: the UI tests exist because someone recorded them, and the API tests do not exist because someone would have to write them.
Writing them is slow for dull reasons. You need the exact endpoints, the order of calls, the request bodies, and the login whose token every later call depends on. The browser has all of it.
How SmartestQA does it
The capture happens inside the test run, and the result lands next to the UI test it came from.
- Your own API calls, nothing else. Analytics, static files and other sites are left out for you.
- The login comes along. The token from the login call is carried to the requests after it.
- No secrets copied. Passwords and tokens never end up in the new test.
- One test, every environment. The same API test runs on each of your environments.
Questions and answers
Why turn UI tests into API tests at all?
API tests run without a browser, so they are faster and fail for fewer unrelated reasons. They also tell you which service broke.
Is this the same as converting a HAR file?
The idea is the same. Here the capture comes from a test run inside the platform, so there is nothing to export or import.
Can I load test the calls I captured?
Yes. Once they are an API test, you can generate a k6 or JMeter load test from it.
Where to read more
See Network Calls to API tests, or the documentation: Network Calls.

