Testing
AuraScore 81/100

E-Commerce Peak Checkout Load Test Generator

Generate production-ready k6 load test scripts simulating high-concurrency retail flash sales and inventory checkout paths.

Use this template when preparing retail platforms for high-volume sales events like Black Friday. It builds resilient performance testing scripts that evaluate cart reservation, payment gateway integration, and stock validation under peak load.

Template

Role: Senior Quality Engineering Specialist with 12+ years of expertise in retail e-commerce scalability and performance stress testing.

Context

  • Target Platform Architecture: {{ecommerce_platform}}
  • Target Concurrency Volume: {{target_concurrency}}
  • Critical Checkout Route: {{checkout_endpoint}}
  • Active Test Stock Keeping Units: {{inventory_skus}}
  • Payment Simulation Provider: {{payment_gateway_mock}}
  • Latency SLA Threshold: {{p95_latency_threshold}}

Task

Author a fully executable k6 load test automation script that simulates realistic customer checkout funnels, validates concurrent stock reservations, and isolates latency bottlenecks across the {{ecommerce_platform}} infrastructure to ensure platform stability under {{target_concurrency}}.

Method

  1. Define stage-based load ramp-up, steady-state peak, and ramp-down execution profiles aligned with {{target_concurrency}}.
  2. Configure explicit threshold assertions enforcing {{p95_latency_threshold}} for HTTP response times and a sub-1% transaction error rate.
  3. Implement parameterized user persona data pools utilizing {{inventory_skus}} to simulate dynamic cart addition and SKU contention.
  4. Script multi-step transaction flows spanning catalogue search, cart addition, stock lock acquisition, and checkout payload dispatch to {{checkout_endpoint}}.
  5. Integrate mock header authentication and payload payload verification targeting {{payment_gateway_mock}} without triggering production billing loops.
  6. Embed custom metric counters and trend tracking for stock collision errors, session drops, and payment gateway round-trip latency.
  7. Implement intelligent retry mechanics with exponential backoff on transient network failures while logging unrecoverable server errors.
  8. Structure modular tear-down logic to release dangling inventory reservations created during execution.

Constraints

  • Scripts MUST be written in syntactically valid modern JavaScript for k6 runtime execution.
  • Scripts MUST NOT hardcode plaintext payment tokens, private keys, or static customer sessions.
  • Handlers MUST explicitly verify HTTP 200/201 response status codes before proceeding through multi-step checkout gates.
  • Custom metrics MUST track distinct tag boundaries for inventory lock versus payment settlement phases.

Output format

Executable k6 JavaScript test script formatted inside a single code block, followed by:

  • Environment variable configuration guide (table of key, type, default, purpose)
  • Scenario breakdown detailing virtual user ramp-up schedules and duration
  • Error handling table listing caught status codes and alert conditions Total response length must remain between 450 and 850 lines of combined code and technical documentation.

Self-review

  • Confirm all 6 context variables ({{ecommerce_platform}}, {{target_concurrency}}, {{checkout_endpoint}}, {{inventory_skus}}, {{payment_gateway_mock}}, {{p95_latency_threshold}}) are actively referenced in script logic.
  • Verify syntax avoids non-k6-compatible Node.js standard library imports.
  • Check that threshold boundaries strictly reflect {{p95_latency_threshold}}.
AuraScore breakdown
81/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness3/5 · Adequate

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

developers
developers-testing
retail-consumer-goods
load-testing
k6
retail