Flakiness Query Language (FQL)
Flakiness Query Language (FQL) is a simple yet powerful language for filtering tests in Flakiness.io.
A few examples:
# Find all flaky tests in the e2e folders:flaked f:e2e
# Find slow tests that are not smoke testsduration>5s -#smoke
# Find tests with a specific error$timeout f:login
# Find tests in a specific file that take longer than 2 secondsf:login.spec.ts duration>2s
# Find all failed tests with "network" in the error messages:failed $networkFilters
Section titled “Filters”FQL supports the following filters:
| Filter Type | Examples | Description |
|---|---|---|
| Test filters | click | Tests that have click in either the test name, suite name, or file name |
| Status filters | s:flaked | Tests that flaked |
| File filters | f:click, file:click | Tests that have click in their file name |
| Line filters | :12 | Tests that are at line #12 |
| Error filters | $undefined | Tests that have undefined in the error text |
| Annotation filters | @skip | Tests that have skip as either the annotation type or inside the annotation text |
| Tags | #smoke | Tests that have smoke in their tags |
| Duration filters | d<1s, duration>100ms | Tests with matching duration |
| Flip rate filters | flip>0%, fr<=50% | Tests with matching flip rate |
Exclusion
Section titled “Exclusion”Any filter can be prefixed with - to exclude matches.
-click # exclude tests that have "click"-<12 # exclude tests that are located before line #12 of some file-#smoke # exclude tests with #smoke tag-s:flaked # exclude flaked testsCombining multiple filters
Section titled “Combining multiple filters”Filters can be combined in any way:
click foo # Tests with "click" and "foo"-#smoke click f:e2e # Tests from e2e folder, not smoke, with "click" in nameWhitespaces and special characters
Section titled “Whitespaces and special characters”If the searched word has a special character or space, the filter token should be
surrounded with quotes. Either single (') or double (") quotes work:
@'foo bar' # search for "foo bar" in annotationsf:'some path' # search for "some path" in file pathsWhen using quotes, you can escape special characters using backslashes:
'can\'t touch this' # Single quotes with escaped apostrophe"say \"hello\"" # Double quotes with escaped quotes"path\\to\\file" # Escaped backslashesThe escaping rules follow JSON conventions:
- Use
\'to include a single quote inside single-quoted strings - Use
\"to include a double quote inside double-quoted strings - Use
\\to include a literal backslash
Number filters
Section titled “Number filters”Line number, duration, and flip rate filters are “number” filters, so mathematical comparison operators can be used:
duration<1s # All tests with duration less than 1 secondf:foo.spec.ts >20 # All tests in `foo.spec.ts` after line 20Duration filter
Section titled “Duration filter”The duration filter accepts various suffixes to specify duration. If there’s no suffix, the number is treated as milliseconds. Fractional values are also accepted.
- nanoseconds:
ns,nanos,nanosecond,nanoseconds - milliseconds:
ms,millis,millisecond,milliseconds - seconds:
s,sec,second,seconds - minutes:
m,min,mins,minute,minutes - hours:
h,hour,hours
d>100ns # Nanosecondsd>100 # Milliseconds (default)d>1.2s # Fractional values are also supportedFlip rate filter
Section titled “Flip rate filter”The flip rate filter matches tests by their flip rate.
Values are percentages (0–100). The % suffix is optional.
flip>0% # Tests that have any flakinessflip>50% # Tests with flip rate above 50%fr<=25 # Tests with flip rate at most 25% (short alias)