[Feature]: API request performance metrics and percentile assertions in Playwright Test
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- playwright, typescript
- Ambito
- performance, testing
Direzione di ricerca
Start by reading the @playwright/test request fixture and APIRequestContext implementation, then trace how workers aggregate results and how terminal and HTML reporters report outcomes. The issue proposes request timing, cross-worker percentile aggregation, failure rates, per-operation thresholds, and CI failure behavior, but does not identify files or settle API details; done means measured values and threshold outcomes appear in reports and failing thresholds produce a non-zero exit code.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
🚀 Feature Request
I use @playwright/test for API testing through its request fixture / APIRequestContext. The existing fixtures, authentication, assertions and reporting work well, and I would like to reuse these tests to detect API performance regressions.
Specifically, I would like opt in request performance metrics and aggregate assertions similar to the following k6 capabilities:
- Latency distributions:
minimum,maximum,mean,median,p90,p95andp99across repeated requests - Request counts and throughput: total requests and achieved requests per second.
- Failure rates: failed requests as a proportion of total requests, including HTTP failures, network errors and timeouts.
- Aggregate thresholds: conditions such as
p(95)<300,p(99)<750andrate<0.01, evaluated after collecting samples. - Per-operation metrics: stable names for requests so
/products/123and/products/456can be aggregated as the same operation, with separate thresholds for different endpoints. - Reporting and CI integration: measured values, sample counts and threshold outcomes in terminal/HTML reports, with a non-zero exit code when a threshold fails.
For example, k6 allows:
thresholds: {
http_req_duration: ['p(95)<300', 'p(99)<750'],
http_req_failed: ['rate<0.01'],
}
Example
The following is illustrative proposed syntax, rather than a requirement for the exact API
export default defineConfig({
// ...rest of the config,
// e.g. a proposed configuration
performance: {
thresholds: {
'list-products': {
duration: ['p(95)<300', 'p(99)<750'],
failureRate: ['rate<0.01'],
},
},
},
});
import { test, expect } from '@playwright/test';
test('list products', async ({ request }) => {
const response = await request.get('/products', {
// Proposed option: record this request under a stable operation name.
performance: { name: 'list-products' },
});
expect(response.ok()).toBeTruthy();
const body = await response.json();
expect(Array.isArray(body.products)).toBeTruthy();
});
After all repetitions complete, Playwright would aggregate the request samples across workers within the project and evaluate the thresholds.
For example, a run could pass every functional assertion but fail its performance criteria because the measured p95 was 340 ms against a 300 ms threshold. The report would show both outcomes.
Measurement behaviour
- Measure individual API requests, excluding test setup and assertions.
- Combine measurements across workers and repetitions before calculating percentiles.
- Include failed requests and timeouts in the failure rate.
- Show the number of requests measured alongside the results.
- Evaluate performance thresholds at the end of the run and fail the run if they are exceeded.
The exact timing boundaries and handling of retries could follow documented defaults.
Motivation
Currently, achieving this requires custom timing, sample collection, aggregation, percentile calculations, threshold evaluation and reporter integration, or maintaining a separate suite in another tool.
workers and repeatEach help execute repeated requests, but do not provide these statistical helpers or aggregate performance assertions.
An initial implementation could focus on API performance regression testing using existing execution controls. More advanced load-generation features, such as virtual users, ramp-up stages and target arrival rates, could be considered separately.
- Lingua principale
- TypeScript
- Stelle
- 98.5k
- Fork
- 6.7k
- Merge medio
- 17h 5m
- PR unite (30g)
- 326
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/playwright
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
microsoft/playwright#43759 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
microsoft/playwright#43741 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 1/100
microsoft/playwright#43813 · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
[Feature]: Opt-in way to keep the worker and its worker-scoped fixtures alive after a test failureAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
microsoft/playwright#43811 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: ariaSnapshot({ mode: 'ai' }) drops the name of dialogs, landmarks, tables and column headers when it comes from a visible descendantForse già presa @microsoft-playwright-automation l’ha presa 1 giorno fa. Apertaneeds-triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
microsoft/playwright#43809 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/playwright
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
code-yeongyu/senpi#5262 ·
I maintainer di solito rispondono entro 1 giorno
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
lingdojo/kana-dojo#33420 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] inspect_schema matches named container case-insensitively without preferring exact matchForse già presa @Maaz2212 l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
libredb/libredb-studio#2128 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Yeachan-Heo/gajae-code#7474 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
mastra-ai/mastra#29108 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno