Network request - test subject

  • Android - WebView apps
  • Apple TV (tvOS) Simulator
  • Browsers
  • HbbTV / Freeview Play
  • LG webOS
  • PlayStation 4/5
  • Roku
  • Samsung Tizen
  • Vizio SmartCast
  • Xbox (One, Series X/S)
  • Xfinity (Comcast)
  • Other Smart TVs and STBs - HTML apps

Network request test subject represent a single network request made during the test execution.

Assertions involving the network request subject will only work when:

  • using Suitestify
  • using Lite solution on LG webOS, Samsung Tizen, VIDAA and Xfinity (Comcast)
  • testing on Xbox (One, Series X/S) devices
  • testing tvOS apps on simulators
Xbox (One, Series X/S) limitation

Start and end time of requests is not available, therefore, requests are only shown once they are completed.

tvOS limitation

Network requests can only be used with simulators (not with physical devices) and do not cover the body of requests (only header, status, URL and method).

size limitation

Suitest does not allow to assert on a body of a network request/response bigger than 20 KB.

Basic Usage

To check if the app has loaded a particular URL:

In Test editor:

Basic network request assertion

In the Suitest JavaScript API use the networkRequest subject:

await suitest.assert.networkRequest().equal('').wasMade();

Matching a set of URLs

Instead of looking for an exact URL, you can look for a substring.

In Test editor:

Network request with matching by part of a URL

In JavaScript API:

await suitest.assert.networkRequest().contains('').wasMade();

This is especially useful if the URL you are looking for contains dynamic parameters.

Matching repetitive requests

Sometimes the app may load the same or similar URL multiple times. You can instruct Suitest to ignore the requests that have previously had a match.

In Test editor:

Network request with matching by part of a URL - excluding previously matched requests

In JavaScript API:

await suitest.assert.networkRequest().contains('').willBeMade();

Matching headers

You can add HTTP headers to the assertion. Both request and response headers are supported.

In Test editor:

Network request matching URL - with headers

In JavaScript API:

await suitest.assert.networkRequest().equals('').requestMatch([
        name: suitest.NETWORK_PROP.METHOD,
        val: suitest.NETWORK_METHOD.GET,
        name: NETWORK_PROP.STATUS,
        val: 200,
        name: 'Content-Type',
        val: 'application/vnd.hbbtv.xhtml+xml',

HTTP headers containing random or changing information are most of the time not suited for assertions.

Network log life cycle

Suitest starts a fresh network log at every test execution initiation. The log is empty at the beginning and fills up as the application progresses through the test. All assertions involving the network request subject are made against that log.

When running the test line-by-line every next execution is considered a separate test run and the network log is cleared. Therefore if you run only the line with a network request assertion it will most definitely fail. You should run the network assertion line together with other parts of the test that will ensure that the network log is properly filled.

Creating network assertions from Suitest console

All network requests made during interactive sessions are listed in Suitest console. You can easily add an assertion based on that network request to your test by pressing Create assertion link

Network logs shown in console with create assertion link