Testing
AuraScore 79/100

Public Welfare Eligibility Calculation API Load and Stress Test Script

Author a k6 load and chaos test script for public assistance benefit eligibility calculation engines.

Use this template when validating the resilience, throughput, and error boundaries of statutory public benefits services under peak surge conditions. It produces an automated k6 performance test script that simulates mass enrollment surges with fault injection.

Template

Role: Staff Site Reliability Test Engineer specializing in mission-critical public assistance infrastructure.

Context

  • Assistance Program: {{benefit_program_name}}
  • Endpoint Specifications: {{api_endpoint_definitions}}
  • Peak Concurrency: {{peak_concurrent_applicants}}
  • Chaos Perturbation Rate: {{failure_injection_rate}}
  • Performance Target: {{latency_slo_threshold}}
  • Identity Authority: {{auth_token_provider}}

Task

Develop a production-grade k6 performance and chaos testing script that simulates massive applicant surge traffic against civic welfare calculation microservices while injecting transient infrastructure faults.

Method

  1. Define realistic virtual user arrival rate curves that ramp to {{peak_concurrent_applicants}} to simulate open-enrollment spikes for {{benefit_program_name}}.
  2. Structure authorization workflows that refresh transient bearer tokens against {{auth_token_provider}} across simulated client threads.
  3. Construct parameter-driven request payloads mirroring complex household income, dependent verification, and eligibility claims from {{api_endpoint_definitions}}.
  4. Introduce randomized network jitter, malformed payloads, and aborted TCP connections at a rate of {{failure_injection_rate}} to stress error-handling paths.
  5. Implement custom k6 metrics tracking p95 and p99 response times against {{latency_slo_threshold}}.
  6. Evaluate eligibility calculation response payloads for data corruption, unexpected 5xx crashes, or concurrency deadlocks.
  7. Generate structured summary metrics highlighting threshold breaches, throughput drops, and recovery times.

Constraints

  • The test script MUST abort execution if error rates exceed 15% within a 30-second sliding window.
  • Synthetic applicant profiles MUST NOT collide on unique identification fields during concurrent requests.
  • Do not hardcode static authentication tokens that expire mid-execution.
  • Custom thresholds MUST fail the CI pipeline if p95 latency exceeds {{latency_slo_threshold}}.

Output format

A single, standalone JavaScript k6 script featuring:

  1. K6 scenario options with ramping arrival rates and failure thresholds.
  2. Token acquisition setup lifecycle function.
  3. Default execution loop with payload generators and chaos injection.
  4. Teardown and custom metric summary reporter.

Self-review

  • Validate that virtual user ramp stages peak exactly at {{peak_concurrent_applicants}}.
  • Ensure chaos perturbations strictly observe the {{failure_injection_rate}} ratio.
  • Verify all endpoints from {{api_endpoint_definitions}} are covered in test iterations.
AuraScore breakdown
79/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 engineering10/12 · Adequate

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
public-sector-nonprofit
k6
load-testing
public-sector