Test Metrics in Looker: A Practical Setup for AQE
Most teams read test results as a checkbox: green ships, red blocks. The useful signal sits between those states, in runtime variance, retry counts and the same handful of tests that turn up in every postmortem. Looker sits on top of a warehouse you may already run (BigQuery, Snowflake, Redshift), which makes it a reasonable home for that signal once test data is treated as an analytics domain rather than CI noise.
The value Looker brings is the semantic layer. Define pass rate, flake rate and P95 duration once in LookML and every dashboard uses the same calculation. That matters more in agentic quality engineering, where the same numbers get read by people and by AI assistants, and where new measures appear: eval pass rate over repeated runs for features that call a model, and how many test runs a coding agent needed before its change went green. If each team computes those differently, nobody can compare them.
This article builds a fact schema, a LookML view with a flaky-test dimension, an Explore and a dashboard tile, then covers where Looker setups break, and how to add governed measures for eval and agent-run data.
Learn Python, Behave, GitHub Copilot, APIs, and CI/CD by building a real framework you can finish in a weekend.
What Looker Adds to a Test Analytics Stack
Looker's value in a test analytics stack is the semantic layer — LookML — not the visualization surface. When you define measures (pass rate, P95 duration, flake rate) and dimensions (suite, branch, environment, failure category) in LookML, every dashboard, alert, and ad-hoc query in your org uses the same calculation. That consistency matters when a VP asks why pass rate dropped and the answer from the CI dashboard contradicts the one from the QE dashboard. As covered in the broader comparison of Grafana, Looker, and Datadog, Looker wins when your primary need is governed, self-serve analytics on top of a warehouse — not real-time streaming panels.
Architecturally, Looker sits downstream of your ingestion layer. JUnit XML or JSON test results land in GCS/S3, a pipeline (dbt, Dataform, or raw SQL transforms) normalizes them into a test_results fact table, and Looker's Explore layer handles aggregation. The warehouse does the compute; Looker handles the semantic contract. This means your flake-rate definition is not buried in a Grafana panel JSON that three people have edited — it lives in version-controlled LookML that your whole org can inspect.
Building the LookML Model and Flaky-Test Dimension
Start with a normalized fact table. The schema below works in BigQuery or Snowflake; adapt types accordingly.
-- test_results fact table (BigQuery)
CREATE TABLE ci.test_results (
run_id STRING NOT NULL,
run_at TIMESTAMP NOT NULL,
branch STRING,
suite_name STRING,
test_name STRING,
status STRING, -- 'passed' | 'failed' | 'skipped' | 'retried'
duration_ms INT64,
retry_count INT64,
failure_msg STRING,
environment STRING
)
PARTITION BY DATE(run_at)
CLUSTER BY suite_name, branch;
Partitioning by date and clustering by suite + branch keeps query costs low when Looker fans out across 90-day windows. Now model it in LookML:
# test_results.view.lkml
view: test_results {
sql_table_name: ci.test_results ;;
dimension: test_name { type: string sql: ${TABLE}.test_name ;; }
dimension: suite_name { type: string sql: ${TABLE}.suite_name ;; }
dimension: branch { type: string sql: ${TABLE}.branch ;; }
dimension: status { type: string sql: ${TABLE}.status ;; }
dimension: environment { type: string sql: ${TABLE}.environment ;; }
dimension: failure_msg_prefix { type: string sql: SUBSTR(${TABLE}.failure_msg, 1, 120) ;; }
dimension_group: run_at {
type: time
timeframes: [raw, date, week, month]
sql: ${TABLE}.run_at ;;
}
dimension: is_flaky {
type: yesno
sql: ${TABLE}.retry_count > 0 AND ${TABLE}.status = 'passed' ;;
description: "Passed only after at least one retry"
}
measure: total_runs {
type: count
}
measure: pass_rate {
type: number
sql: COUNTIF(${TABLE}.status = 'passed') / NULLIF(COUNT(*), 0) ;;
value_format_name: percent_2
}
measure: flake_rate {
type: number
sql: COUNTIF(${TABLE}.retry_count > 0 AND ${TABLE}.status = 'passed')
/ NULLIF(COUNT(*), 0) ;;
value_format_name: percent_2
}
measure: p95_duration_ms {
type: percentile
percentile: 95
sql: ${TABLE}.duration_ms ;;
}
}
The is_flaky dimension is the key piece most setups skip. A test that retried twice and eventually passed is not a "pass" for reliability purposes — it's a deferred failure. Surfacing it as a yesno dimension means any Looker user can filter or pivot on flakiness without writing SQL. For a deeper look at why raw pass/fail counts mislead, the article on why pass/fail metrics are misleading is worth reading before you present these numbers to leadership.
Wire the Explore and add a simple trend tile to your dashboard:
# ci_quality.explore.lkml
explore: test_results {
label: "CI Test Quality"
always_filter: {
filters: [test_results.environment: "production,staging"]
}
}
# Dashboard tile: 7-day flake rate by suite (Looker dashboard JSON excerpt)
{
"title": "Flake Rate by Suite (7d)",
"type": "looker_line",
"query": {
"model": "ci_analytics",
"explore": "test_results",
"dimensions": ["test_results.suite_name", "test_results.run_at_date"],
"measures": ["test_results.flake_rate"],
"filters": {"test_results.run_at_date": "7 days"},
"sorts": ["test_results.run_at_date desc"]
}
}
Once this dashboard replaces manual log-grepping, the combination of flake_rate trend lines and the failure_msg_prefix dimension (the first 120 characters of the failure message) makes the most frequent recurring failures visible at a glance. If you're also feeding this data into a Postgres-backed pipeline, the approach in building test metrics in Postgres maps cleanly to the same schema before the warehouse load step.
Where Looker Test Setups Break in Practice
Fanout inflation on retries is the most common silent data quality issue. If your ingestion pipeline writes one row per attempt (not per final status), a test that retried three times contributes four rows to COUNT(*). Your pass rate looks better than it is, and your total run count is meaningless. Fix it at the transformation layer — deduplicate on (run_id, test_name), keeping the final attempt — before Looker ever sees the data. Trying to compensate in LookML measures is fragile and confuses anyone who queries the raw table directly.
Suite composition drift silently skews trend lines. When a team adds 200 fast unit tests to a suite that previously contained only slow integration tests, the aggregate pass rate jumps and P95 duration drops — not because quality improved, but because the mix changed. This is the same problem described in detail when suite composition skews the metrics you report. Track suite-level metrics in separate Looker tiles rather than rolling everything into a single org-wide pass rate; cross-suite aggregation is almost always misleading without normalization.
Governed measures for eval results and agent runs
The argument for LookML, one definition per metric under version control, applies directly to the numbers agentic QE introduces. Two are worth modelling early.
The first is eval pass rate for features that call a model. Each eval case runs several times per build, so the honest measure is a rate per case, per prompt version and per model version, not a single pass or fail. Model the samples as their own view rather than folding them into test_results, or a sampling wobble in one prompt shows up as a flake in the CI suite:
view: eval_samples {
sql_table_name: ci.eval_samples ;;
dimension: case_id { type: string sql: ${TABLE}.case_id ;; }
dimension: prompt_version { type: string sql: ${TABLE}.prompt_version ;; }
dimension: model_version { type: string sql: ${TABLE}.model_version ;; }
dimension: judge_version { type: string sql: ${TABLE}.judge_version ;; }
measure: samples { type: count }
measure: eval_pass_rate {
type: number
sql: COUNTIF(${TABLE}.passed) / NULLIF(COUNT(*), 0) ;;
value_format_name: percent_1
}
}
Keep judge_version as a dimension if an LLM grades the samples. When the judge changes, pass rate can move without the product changing, and you need to be able to pivot on it to tell the difference.
The second is agent run cost: for changes opened by a coding agent, how many CI runs happened before the first green build. Add a triggered_by dimension to test_results and a measure counting runs per pull request. A rising number usually means the agent is iterating against the suite rather than reasoning about the change, and that every one of those runs is billed.
Finally, if an AI assistant answers questions from these Explores, point it at the governed measures rather than raw SQL access, so its "pass rate" is the same pass rate leadership sees. More on that pattern in building a test-insight copilot.
Can Pass/Fail Be Metrics? What Most Teams Get Wrong
Yes — but only if you're precise about what they measure. Raw pass/fail counts answer "did anything break today?" They don't answer "is the suite getting more reliable over time?" or "which tests are burning engineer time?" Teams that build Looker dashboards around pass/fail counts end up with vanity metrics: a 98% pass rate that masks a core checkout flow that flakes every third run. The useful metrics are flake rate by test, mean time to green per branch, P95 duration trend by suite, and failure recurrence rate — all derivable from the LookML model above, none of them visible in a simple pass/fail count.
A second common mistake is treating Looker as a replacement for operational alerting. Looker Alerts can ping Slack when flake rate crosses a threshold, but they run warehouse queries on a schedule, so they lag behind the pipeline. For immediate on-call signal, wire PagerDuty or a Datadog monitor to your ingestion pipeline, and reserve Looker for the trend analysis and postmortem work where the latency is acceptable. Conflating the two layers leads to alert fatigue on one side and slow dashboards on the other.
A working Looker setup for test metrics comes down to three things: a clean fact schema with retry semantics handled before the warehouse, a LookML semantic layer that defines flake rate and duration percentiles once, and suite-level tiles instead of a single aggregate pass rate. From here, the logical next step is connecting these warehouse metrics to your deployment pipeline — the overlap between test metrics and DORA metrics is closer than most teams realize, and the same BigQuery tables power both.
Note: This article is for informational purposes only and is not a substitute for professional advice. If you need guidance on specific situations described in this article, consider consulting a qualified professional.