Allure TestOps - Query language

Query language

Allure TestOps has its own query language (AQL) allowing you to create flexible searches through the test cases, test results, and launches.

Use cases

Here is how you can use the AQL:

  1. In a project’s analytics.
  2. In widgets to narrow down the results to needed details.
  3. When performing API requests to filter out the results returned from Allure TestOps back-end.

Supported expressions

Currently, AQL supports six expression types. They are listed here in the decreasing priority order:

Expression type example
Parenthesis ( expression )
Negation not expression
Logical expression true or false
Logical AND expression and expression
Logical OR expression or expression
Checking the attribute’s value attribute operand value

Checking the attribute’s value is the main query unit.

Queries’ attributes

The list of available attributes available for a query depends on the query target.

Queries are supported for searching in following targets:

Target Link
Test case Description and examples
Test result Description and examples
Launch Description and examples

Attribute types

Attributes can be simple like value id or name and composite - related to other objects like status or cf (custom filed).

Composite attributes copuld use either the names or the IDs of a related object.

Every approach has its own pros and cons. Using the object name makes the query easier to read, but if the name changes, the query becomes invalid and you will need to rewrite it.

Example

Using the ID makes the writing and reading more complicated but guarantees that renaming an object won’t invalidate the query.

A query example

Query example for a TestCase search:

(name ~= "first" or name ~= "second") and createdBy = "user1"

This query returns all test cases that include first or second substring in their name, and created by the user with the user1 username.

Supported operands

Currently, the following operands are supported in AQL:

Operand meaning applicable to
< less than numbers
<= less than or equal to numbers
> greater than numbers
>= greater than or equal to numbers
=, is equal to numbers, strings, boolean
!= not equal to numbers, strings, boolean
~= contains (string) strings
in is present in (array) numbers, strings
Wildcards aren’t supported.

Supported value types

AQL supports following value types:

  1. number - a number, e.g., id = 123
  2. boolean - values true or false, e.g. deleted is false or muted is true
  3. string - a set of characters, should be enclosed within double quotation marks: name = "some test case name"
  4. array - an array (a list), should be enclosed within square brackets [ ].
    • Values in arrays to be separated by commas: name in ["first", "second"] or id in [123, 124]
  • function in the query context, extra functions are available, e.g.:

    1. now() — the current moment
    2. dayStartUtc() — start of the day in the UTC time zone
    3. weekAgo() — a week ago (exactly 168 hours)
    4. currentUser() — the current system user
these functions are unavailable for the test plans

All dates use the UNIX TIMESTAMP format in milliseconds.

RQL for different type of targets

|