Why does my dashboard query throw an error?
Tests and Runs use different TQL variables. A query written for tests won’t work on runs. Check which one your widget uses, then use that entity’s variables.
Most common mistake, status. Tests use an operator, runs use a bare keyword:
# Testsstatus == 'passed'# RunspassedWriting status == 'passed' in a runs query is the usual cause of the error.
Second mistake, has_ variables. In runs queries, has_ filters runs by the tests inside them. Without it, you filter the run’s own attributes:
# Runs tagged 'slow'tag == 'slow'# Runs CONTAINING tests tagged 'regression'has_test_tag == 'regression'Quick comparison
Section titled “Quick comparison”| What you want | Tests query | Runs query |
|---|---|---|
| By status | status == 'failed' |
failed |
| By tag | tag == 'regression' |
has_test_tag == 'regression' |
| By suite | suite % 'Checkout' |
has_suite % 'Checkout' |
| By test title | test % 'User login' |
has_test % 'User login' |
| By priority | priority == 'critical' |
has_priority == 'critical' |
Examples that work
Section titled “Examples that work”# Tests: failed tests with the smoke tagstatus == 'failed' and tag == 'smoke'# Runs: failed runs containing tests tagged regressionfailed and has_test_tag == 'regression'