Skip to content
Rehearsev1.2.0

Set aside a field that changes every run

Stop a field that differs on every run from showing as a change nobody announced.

The greeting below answers with servedBy, the id of the process that served it. Nothing changed between the base and the head, yet each run has another process, so the comparison reports a slip.

Terminal
$ rehearse compare
0 as on the base · 1 changed without saying so
changed without saying so:
The greeting says hello (greeting.hurl:2)
$.servedBy: 1351401 → 1351426
unannounced, by what changed:
$.servedBy — in 1 scenario
1 id, time or opaque value was set aside before comparing.

Rehearse sets aside ids, times and opaque values on its own. A plain number under a key it doesn’t know as an id is compared.

Name the key in setAside in rehearse.yaml. Each entry of keys is a regular expression over JSON keys, and their values are set aside.

rehearse.yaml
base: main
services:
api:
up: node server.mjs {{port}}
port: auto
ready: http://127.0.0.1:{{port}}/health
scenarios:
calls: ['**/*.hurl']
setAside:
keys: ['^servedBy$']

Compare again. Rehearse keeps observations raw, so the rule applies to the cached base without running it again.

Terminal
$ rehearse compare
1 as on the base
2 ids, times and opaque values were set aside before comparing.
1 base observation came from the cache (a7e89b212432).

The field is set aside on both sides, and the count says so. For text, such as a value inside an accessibility tree, use values instead; to protect one field from the rules, list it under keep. See setAside.