Network activity and logs

Record the network logs and console logs of every run, read them beside each step, fail a test on a failed request or a console error, and export a HAR file.

On this page9
  1. 1Network logs and console logs of every run
  2. 2What is recorded, for each kind of app
  3. 3Turn it on
  4. 4Watch Network and Watch Log
  5. 5Check Network and Check Log: fail a test on a failed request or an error
  6. 6Read it in the Confidence Report
  7. 7Export a HAR file, the log, or a request as cURL
  8. 8In your pipeline and your bug reports
  9. 9What is never recorded

Network logs and console logs of every run

A run can record what happened beside the screen: the requests a web page made, the connections a desktop program opened, the console, a program's debug output, a log file, a phone's log. Everything is kept on the run's own clock, so the Confidence Report shows it beside the step that was running.

When a check fails, you see at once whether the screen was wrong because the server answered with an error, because a script crashed, or because the app itself changed.

What is recorded, for each kind of app

App under testNetworkLog
A web app, in Chrome, Edge or Firefox, with or without a windowEvery request of the page: its address, status, type, size and timing, the requests that failed and why, the answers that came from the cache.The page's console: messages, warnings, errors and uncaught errors.
A desktop appIts connections: which server it reached, on which port, and the ones that were refused.Its debug output, and any log file you name: only the lines written during the run.
An Android phoneNot recorded.The phone's own log: its warnings and errors.

Turn it on

When you record

In the question What do you want to test?, the switch Record network activity and logs during test runs is on by default for a web app, an app and a phone.The test then records them at every run, with nothing more to set.

On a step of the test

Open Web App, Run App and Connect Phone have a Record During a Run section in their Properties: Record network activity, Record the console log for a web page, Record debug output and a Log file for a program, Record the phone's log for a phone.

Watch Network and Watch Log

Two events of the Events palette's Test Flow group start recording at any moment of the test.Drop one on the timeline: it lands on the time ruler, like a Wait.See Test Flow: waits, apps, phones and scripts.

EventWatchWhat it records
Watch NetworkThe app under test, a program, every program on this computer, or Stop watchingThe page's requests, or the connections of the programs.
Watch LogThe app under test, a program's debug output, a log file, or Stop watchingThe console, the debug output, or every line added to the file.

A log file's name may hold a star, such as C:\MyApp\logs\*.log: every file that matches is followed, including one created during the run.Watches add up, and a Stop watching ends every watch of its kind.

Check Network and Check Log: fail a test on a failed request or an error

Two more Test Flow events turn what was recorded into a check. Put one after the steps it should cover. Each one looks at what was recorded since the previous check of the same rule, or since the start of the run for the first one, so a failure points at the part of the test where it happened.

EventCheck thatPasses when
Check NetworkNo request failedNo request answered with an error or failed to reach its server. Addresses you list under Except addresses containing are let through.
Check NetworkA request was answeredA request to an address containing the text you give was answered without an error. The step waits for it, up to its time.
Check LogNo error was loggedNo error was logged. Lines you list under Except lines containing are let through.
Check LogThe log saysA line containing the text appears. The step waits for it, up to its time.
Check LogThe log does not sayNo line containing the text was logged.

Wait up to is 5 seconds by default.Separate several exceptions with a semicolon.Like every step, a check has If It Fails: Stop the test, the default, or Continue the test.

ExampleWait for the server, not the clock

After the click on Save, a Check Network with A request was answered and Address contains = /api/orders waits for the server to confirm the order.The test goes on the moment it does, and fails with the reason when the server answers an error or does not answer in time.No fixed Wait is needed.

ExampleNo error in the console

At the end of the checkout, a Check Log with No error was logged and Except lines containing = analytics fails the test the day a script of the page starts to crash, even when the screen still looks right.

Read it in the Confidence Report

A run that recorded something has an Activity button in the report's toolbar.It opens the Activity panel, with a Network tab and a Log tab, each with how many records and how many failed.

Every request of the run, when it happened, and how long it took. A failed request is red.
ToDo
See only what went wrongClick Errors only.
See what happened during one stepSelect the step, then click Selected step only. Its span is shaded on the timeline of the requests.
Find a requestType part of its address, its status or a word of a log line in the filter. The type list keeps only data calls, pages, scripts, styles, images, fonts or connections.
See a request's detailsClick it: its headers, how long the server was waited for and how long the answer took to arrive.
Go to the step that was runningClick Go to step.

The run's timeline also carries a red mark wherever a request failed or an error was logged.

During this step

When the step you select had a failed request or a logged error, a line above the steps says so, such as During this step: POST shop.example.com/api/cart answered 500 · 2 errors logged.Show in Activity opens the panel on that request.

Export a HAR file, the log, or a request as cURL

  1. 1

    The requests as a HAR file

    In the Activity panel, Export then Network activity (.har)....A HAR file is the format the developer tools of every major browser open, so a developer reads the run's requests in the tool they know.

  2. 2

    The log as text

    Export then Log (.txt)...: every line with its moment, its level and where it came from.

  3. 3

    One request as a command

    Right-click a request, then Copy as cURL: the developer runs the very same call in a terminal.

In your pipeline and your bug reports

gtr-cli prints a line per test, such as Activity: 6 requests (3 failed), 23 log lines (20 errors), the first failures under a test that did not pass, and an activity part in its JSON results.With --artifacts, the folder holds network.har and log.txt beside the video.See Run tests in your pipeline.

A bug report says what went wrong around the failed step, and its evidence zip holds the same two files, also when the report becomes a Jira issue.See Create a bug report.

An AI assistant connected through the connector reads a run's activity with its results, and can add Watch and Check steps to a test.See Create a test from a prompt.

What is never recorded

NeverWhy
What a request sent or received: no body is ever kept.A test's evidence must be safe to attach to a ticket.
A header or a part of an address that carries a secret: authorization, cookies, tokens, keys, passwords.They are kept as (hidden), so a HAR file or a cURL command never leaks them.
A desktop program's requests, and a phone's network.They cannot be read from outside without changing the machine or the phone. Their connections and logs are recorded.
Anything outside a run.Recording a test and editing it record nothing beside the screen.

The recording stays with the run's results, in the test's folder on your computers.

To go further: network logs and console logs in test runs, catch console errors in automated tests, a HAR file from every test run and wait for an API response in UI tests.

Next: Read the Confidence Report, or Test Flow: waits, apps, phones and scripts.

Still stuck?Tell us what you were trying to do, and we answer within one working day.

Ask our team