Docs

Device Queries

Device queries let you define reusable filters that select devices by their attributes. Once created, a query can be referenced when creating a test job to control which devices the job runs on.

Overview

A device query is a named set of conditions. Each condition filters devices by a device attribute (such as OS version, model, or label). When a job references a query, RobusTest evaluates the conditions against available devices and picks only those that match.

Device queries are scoped to a project. You manage them via the API or through the RobusTest UI.


Creating a Device Query

POST /v3/devicequery/:id

The :id in the path is a new ID placeholder — pass any valid ObjectId string.

Request body:

{
  "name": "Android 12 Devices",
  "project": "<project ID>",
  "desc": "Devices running Android 12",
  "conditions": [
    {
      "attribute": "version",
      "operator": "=",
      "value": ["12"]
    }
  ]
}
Field Description
name Display name for the query
project ID of the project this query belongs to
desc Optional description
conditions Array of filter conditions (see below)

Condition Fields

Field Description
attribute Device attribute to filter on (e.g. osVersion, model, label)
operator Comparison operator: =, ==, >, >=, <, <=, in
value Value to compare against

Multiple conditions are combined with AND logic — a device must satisfy all conditions to match.


Listing Queries

GET /v3/devicequeries/:projectID

Returns all device queries for the specified project.


Updating a Query

PUT /v3/devicequery/:id

Request body: same structure as create. The conditions array replaces the existing conditions.


Deleting a Query

DELETE /v3/devicequery/:id

Using Device Queries in a Job

Device queries are not referenced by ID in the job payload. Instead, the conditions are passed inline in the devices.deviceQueries array. Each item in the array defines the filter conditions and device count requirements for that query.

{
  "project": "<project ID>",
  "build": {
    "aut": "<build ID>"
  },
  "runMode": "distributed",
  "devices": {
    "deviceQueries": [
      {
        "minDeviceCount": 1,
        "maxDeviceCount": 5,
        "conditions": [
          {
            "attribute": "version",
            "operator": "=",
            "value": ["12"]
          }
        ]
      }
    ]
  }
}

Multiple conditions within a single query item use AND logic — a device must satisfy all conditions to be selected. See Job Payload Reference for the full deviceQueries field reference.