> ## Documentation Index
> Fetch the complete documentation index at: https://onetest.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OQL Examples

> Real-world OneTest Query Language examples

Real-world OQL query examples for common testing scenarios.

## Test Management

> [accordion] Find All Smoke Tests
>
> ```oql theme={null}
> tags CONTAINS "smoke" AND status = active
> ORDER BY priority ASC
> ```
>
> Returns all active smoke tests, sorted by priority.

> [accordion] Failed Tests from Last Run
>
> ```oql theme={null}
> status = failed AND last_run >= -7d
> ORDER BY last_run DESC
> ```
>
> Tests that failed in the last week.

> [accordion] High Priority Tests
>
> ```oql theme={null}
> priority IN (p0, p1) AND status != archived
> ORDER BY created_at DESC
> ```
>
> All P0 and P1 tests that aren't archived.

> [accordion] Tests Never Run
>
> ```oql theme={null}
> last_run IS NULL AND status = active
> ORDER BY created_at ASC
> ```
>
> Active tests that have never been executed.

> [accordion] Recently Updated Tests
>
> ```oql theme={null}
> updated_at >= -14d
> ORDER BY updated_at DESC
> LIMIT 50
> ```
>
> Tests modified in the last 2 weeks.

> [accordion] Deprecated Tests to Archive
>
> ```oql theme={null}
> tags CONTAINS "deprecated" AND
> last_run < -90d AND
> status != archived
> ```
>
> Deprecated tests not run in 3 months.

## Feature-Specific

> [accordion] Authentication Tests
>
> ```oql theme={null}
> (title ~ "login" OR title ~ "auth" OR title ~ "signup") AND
> tags CONTAINS ANY (smoke, regression) AND
> status = active
> ORDER BY priority ASC
> ```
>
> Important authentication tests.

> [accordion] API Tests for Endpoint
>
> ```oql theme={null}
> tags CONTAINS "api" AND
> title ~ "/users" AND
> test_type = automated
> ```
>
> Automated API tests for users endpoint.

> [accordion] Mobile-Specific Tests
>
> ```oql theme={null}
> tags CONTAINS ANY (ios, android, mobile) AND
> status = active
> ORDER BY platform, priority
> ```
>
> All mobile tests grouped by platform.

> [accordion] Payment Flow Tests
>
> ```oql theme={null}
> (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

> [accordion] Flaky Tests
>
> ```oql theme={null}
> 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).

> [accordion] Slow Tests
>
> ```oql theme={null}
> avg_duration > 300 AND
> status = active
> ORDER BY avg_duration DESC
> LIMIT 20
> ```
>
> Tests taking longer than 5 minutes on average.

> [accordion] Tests Failing in Production
>
> ```oql theme={null}
> environment = production AND
> status = failed AND
> last_run >= -24h
> ORDER BY priority ASC
> ```
>
> Recent production failures.

> [accordion] Untriaged Failures
>
> ```oql theme={null}
> status = failed AND
> defect_links IS NULL AND
> last_run >= -7d
> ```
>
> Failed tests without linked bugs.

## Sprint & Release Planning

> [accordion] Tests for Current Sprint
>
> ```oql theme={null}
> tags CONTAINS "sprint-24" AND
> status IN (active, approved)
> ORDER BY priority ASC
> ```
>
> Tests tagged for sprint 24.

> [accordion] Release Blockers
>
> ```oql theme={null}
> priority = p0 AND
> (status = failed OR status = blocked) AND
> tags CONTAINS "release"
> ```
>
> Critical tests blocking release.

> [accordion] Regression Suite
>
> ```oql theme={null}
> tags CONTAINS "regression" AND
> status = active AND
> automated = true
> ORDER BY folder_path, priority
> ```
>
> Automated regression tests by folder.

> [accordion] Tests Created This Sprint
>
> ```oql theme={null}
> created_at >= startOfMonth() AND
> created_by = "current_user"
> ORDER BY created_at DESC
> ```
>
> Your tests from this month.

## Team & Ownership

> [accordion] My Tests
>
> ```oql theme={null}
> created_by = "current_user"
> ORDER BY updated_at DESC
> ```
>
> All tests you created.

> [accordion] Tests Assigned to Me
>
> ```oql theme={null}
> assigned_to = "current_user" AND
> status IN (active, in_review)
> ```
>
> Tests assigned to you.

> [accordion] Tests Pending Review
>
> ```oql theme={null}
> status = in_review AND
> reviewer = "current_user"
> ORDER BY created_at ASC
> ```
>
> Tests waiting for your review.

> [accordion] Team's Work This Week
>
> ```oql theme={null}
> team = "qa" AND
> created_at >= startOfWeek()
> ORDER BY created_at DESC
> ```
>
> QA team's tests from this week.

## Organization & Cleanup

> [accordion] Tests Without Tags
>
> ```oql theme={null}
> tags IS NULL OR tags = []
> ORDER BY created_at DESC
> LIMIT 100
> ```
>
> Untagged tests needing organization.

> [accordion] Tests Not in Folders
>
> ```oql theme={null}
> folder_id IS NULL AND
> status = active
> ```
>
> Tests at root level.

> [accordion] Duplicate Tests
>
> ```oql theme={null}
> title ~ "copy" OR title ~ "duplicate"
> ORDER BY title ASC
> ```
>
> Potentially duplicate tests by name.

> [accordion] Old Draft Tests
>
> ```oql theme={null}
> status = draft AND
> created_at < -30d
> ORDER BY created_at ASC
> ```
>
> Draft tests older than 30 days.

## Advanced Combinations

> [accordion] Complex Coverage Analysis
>
> ```oql theme={null}
> (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.

> [accordion] Environment-Specific Issues
>
> ```oql theme={null}
> 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.

> [accordion] Automation Candidates
>
> ```oql theme={null}
> 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).

> [accordion] Quality Trend Analysis
>
> ```oql theme={null}
> 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

> [card] Start Simple
>
> Begin with one condition and add more:
>
> ```oql theme={null}
> status = active
> → status = active AND priority = p1
> → status = active AND priority = p1 AND tags CONTAINS "smoke"
> ```

> [card] Use Parentheses
>
> Make complex logic clear:
>
> ```oql theme={null}
> (A OR B) AND (C OR D)
> ```

> [card] Order Matters
>
> Put most selective conditions first for better performance:
>
> ```oql theme={null}
> priority = p0 AND status = active  # Better
> status = active AND priority = p0  # Still works, but less optimal
> ```

> [card] Save Frequent Queries
>
> Save complex queries for reuse instead of rewriting them

## What's Next?

> [card] [Syntax Reference](https://onetest.ai/oql/syntax.md)
>
> Complete OQL syntax documentation

> [card] [Field Reference](https://onetest.ai/oql/field-reference.md)
>
> All searchable fields


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.