Skip to main content
Real-world OQL query examples for common testing scenarios.

Test Management

tags CONTAINS "smoke" AND status = active
ORDER BY priority ASC
Returns all active smoke tests, sorted by priority.
status = failed AND last_run >= -7d
ORDER BY last_run DESC
Tests that failed in the last week.
priority IN (p0, p1) AND status != archived
ORDER BY created_at DESC
All P0 and P1 tests that aren’t archived.
last_run IS NULL AND status = active
ORDER BY created_at ASC
Active tests that have never been executed.
updated_at >= -14d
ORDER BY updated_at DESC
LIMIT 50
Tests modified in the last 2 weeks.
tags CONTAINS "deprecated" AND
last_run < -90d AND
status != archived
Deprecated tests not run in 3 months.

Feature-Specific

(title ~ "login" OR title ~ "auth" OR title ~ "signup") AND
tags CONTAINS ANY (smoke, regression) AND
status = active
ORDER BY priority ASC
Important authentication tests.
tags CONTAINS "api" AND
title ~ "/users" AND
test_type = automated
Automated API tests for users endpoint.
tags CONTAINS ANY (ios, android, mobile) AND
status = active
ORDER BY platform, priority
All mobile tests grouped by platform.
(title ~ "payment" OR title ~ "checkout" OR tags CONTAINS "payment") AND
priority IN (p0, p1, p2)
ORDER BY priority ASC, title ASC
Critical payment-related tests.

Quality Analysis

pass_rate < 0.8 AND
pass_rate > 0 AND
execution_count >= 5 AND
status = active
ORDER BY pass_rate ASC
Tests with inconsistent results (60-80% pass rate).
avg_duration > 300 AND
status = active
ORDER BY avg_duration DESC
LIMIT 20
Tests taking longer than 5 minutes on average.
environment = production AND
status = failed AND
last_run >= -24h
ORDER BY priority ASC
Recent production failures.
status = failed AND
defect_links IS NULL AND
last_run >= -7d
Failed tests without linked bugs.

Sprint & Release Planning

tags CONTAINS "sprint-24" AND
status IN (active, approved)
ORDER BY priority ASC
Tests tagged for sprint 24.
priority = p0 AND
(status = failed OR status = blocked) AND
tags CONTAINS "release"
Critical tests blocking release.
tags CONTAINS "regression" AND
status = active AND
automated = true
ORDER BY folder_path, priority
Automated regression tests by folder.
created_at >= startOfMonth() AND
created_by = "current_user"
ORDER BY created_at DESC
Your tests from this month.

Team & Ownership

created_by = "current_user"
ORDER BY updated_at DESC
All tests you created.
assigned_to = "current_user" AND
status IN (active, in_review)
Tests assigned to you.
status = in_review AND
reviewer = "current_user"
ORDER BY created_at ASC
Tests waiting for your review.
team = "qa" AND
created_at >= startOfWeek()
ORDER BY created_at DESC
QA team’s tests from this week.

Organization & Cleanup

tags IS NULL OR tags = []
ORDER BY created_at DESC
LIMIT 100
Untagged tests needing organization.
folder_id IS NULL AND
status = active
Tests at root level.
title ~ "copy" OR title ~ "duplicate"
ORDER BY title ASC
Potentially duplicate tests by name.
status = draft AND
created_at < -30d
ORDER BY created_at ASC
Draft tests older than 30 days.

Advanced Combinations

(tags CONTAINS "smoke" OR priority = p0) AND
status = active AND
(last_run IS NULL OR last_run < -7d) AND
automated = false
ORDER BY priority ASC, created_at DESC
Critical manual tests needing execution.
status = failed AND
environment = staging AND
(environment != production OR
 last_run_production = passed) AND
last_run >= -24h
Tests failing in staging but passing (or not run) in production.
automated = false AND
execution_count >= 10 AND
pass_rate > 0.9 AND
avg_duration < 600 AND
tags CONTAINS ANY (smoke, regression)
ORDER BY execution_count DESC
Stable manual tests run frequently (good automation candidates).
status = active AND
last_run >= -30d AND
(
  (pass_rate < 0.7 AND pass_rate_previous_month > 0.9) OR
  (avg_duration > avg_duration_previous_month * 1.5)
)
ORDER BY pass_rate ASC
Tests with declining quality or performance.

Tips for Writing Queries

Start Simple

Begin with one condition and add more:
status = active
→ status = active AND priority = p1
→ status = active AND priority = p1 AND tags CONTAINS "smoke"

Use Parentheses

Make complex logic clear:
(A OR B) AND (C OR D)

Order Matters

Put most selective conditions first for better performance:
priority = p0 AND status = active  # Better
status = active AND priority = p0  # Still works, but less optimal

Save Frequent Queries

Save complex queries for reuse instead of rewriting them

What’s Next?