TestKase
TestKase
|Docs
AutomateMobile

Network capture

Get a real HAR file of everything a phone sent during your test, and know when it did not work.

A mobile session can record every network request the device made, as a HAR file. That is the format Chrome DevTools and Charles both open.

This is the only real HAR we produce. Desktop browser sessions record network activity in a different format — see Sessions & Artifacts.

Turning it on

It is off unless you ask. Add one line to your capabilities:

{
  "testkase:options": {
    "network": true
  }
}

The session then has a HAR file on it, next to the video and the logs.

How it works

We put a listener between the phone and the internet, and route the device's traffic through it.

For a browser session, the source depends on the browser:

SessionWhere the HAR comes from
Chrome on AndroidChrome's own network log. No listener involved
Safari on iOSThe listener, same as an app session

When it does not work

Capture never fails your test, and never warns you. If it cannot start, your test runs normally and passes or fails on its own. Nothing in the session tells you the capture did not happen. You have to look at the HAR.

Two things to recognise:

No HAR at all, on a session where you asked for one. The listener never started.

A HAR with almost nothing in it. The listener ran, but the phone's traffic never reached it. A file of a few hundred bytes on a busy test means this — not "my app made no requests".

If either happens on a test that should have traffic, run it again first. If it repeats, send us the device and session, because it is a problem with that phone rather than your capabilities.

What a HAR will not show you

Pinned certificates stay unreadable. If your app checks the exact certificate it expects, that traffic passes through unread. Those requests appear without their contents.

This is pinning working as designed, not a fault. Build a version without pinning if you need to see inside those calls.

Android needs one extra step, and we do it for you. Android apps from version 7 ignore certificates a user installed, so we rewrite your .apk at install time to trust ours.

That rewrite is also best-effort. If it does not apply, your app still runs and you still get a HAR — but your app's own HTTPS stays unreadable inside it.