Prompt

k6 checkout flow load test

Technology / Testing & QA1 observationLast seen Oct 20, 2026

Latest observation

Oct 20, 2026OpenAI APIWeb search: off

Here’s a practical k6 checkout flow load test example you can adapt for your app.

What it tests

A typical checkout flow:

  1. Open homepage
  2. Search/browse product
  3. View product
  4. Add to cart
  5. Go to checkout
  6. Submit order

Example k6 script

import http from 'k6/http';
import { check, sleep } from 'k6';
import { Trend, Rate } from 'k6/metrics';

export const options = {
  stages: [
    { duration: '1m', target: 10 },   // ramp up
    { duration: '3m', target: 50 },   // steady load
    { duration: '1m', target: 100 },  // spike
    { duration: '3m', target: 100 },  // hold
    { duration: '1m', target: 0 },    // ramp down
  ],
  thresholds: {
    http_req_failed: ['rate<0.01'],
    http_req_duration: ['p(95)<1000'],
    checkout_success: ['rate>0.95'],
  },
};

const BASE_URL = __ENV.BASE_URL || 'https://example.com';

export const checkout_success = new Rate('checkout_success');
export const checkout_duration = new Trend('checkout_duration');

export default function () {
  const params = {
    headers: {
      'Content-Type': 'application/json',
    },
  };

  const start = Date.now();

  // 1. Home page
  let res = http.get(`${BASE_URL}/`);
  check(res, {
    'home loaded': (r) => r.status === 200,
  });

  // 2. Browse/search product
  res = http.get(`${BASE_URL}/products`);
  check(res, {
    'products page loaded': (r) => r.status === 200,
  });

  // 3. View a product
  const productId = Math.floor(Math.random() * 1000) + 1;
  res = http.get(`${BASE_URL}/products/${productId}`);
  check(res, {
    'product page loaded': (r) => r.status === 200,
  });

  // 4. Add to cart
  const addToCartPayload = JSON.stringify({
    product_id: productId,
    quantity: 1,
  });

  res = http.post(`${BASE_URL}/cart/add`, addToCartPayload, params);
  const addToCartOk = res.status === 200 || res.status === 201;
  check(res, {
    'added to cart': () => addToCartOk,
  });

  // 5. Checkout page
  res = http.get(`${BASE_URL}/checkout`);
  check(res, {
    'checkout page loaded': (r) => r.status === 200,
  });

  // 6. Submit order
  const orderPayload = JSON.stringify({
    shipping_address: {
      name: 'Test User',
      line1: '123 Main St',
      city: 'New York',
      state: 'NY',
      postal_code: '10001',
      country: 'US',
    },
    payment_method: 'test_card',
  });

  res = http.post(`${BASE_URL}/checkout/submit`, orderPayload, params);
  const success = res.status === 200 || res.status === 201;
  checkout_success.add(success);
  checkout_duration.add(Date.now() - start);

  check(res, {
    'order submitted': () => success,
  });

  sleep(1);
}

Run it

k6 run -e BASE_URL=https://your-site.com checkout_test.js

Notes for real checkout testing

You’ll usually need to add:

  • Authentication: login first or use a token
  • Session handling: cookies / CSRF token
  • Dynamic product IDs: pull from API instead of hardcoding
  • Cart persistence: use same session across requests
  • Test payment gateway: use sandbox/test cards only
  • Correlation: extract values like CSRF, cart ID, order token from responses

If your checkout uses APIs

A more realistic checkout load test often hits backend endpoints directly:

  • POST /api/login
  • GET /api/products
  • POST /api/cart
  • POST /api/checkout
  • POST /api/payments/confirm

Good thresholds to start with

You can tune these based on your SLA:

thresholds: {
  http_req_failed: ['rate<0.01'],
  http_req_duration: ['p(95)<1000'],
  checkout_success: ['rate>0.98'],
}

If you want, I can also provide:

  1. a login + checkout k6 script
  2. a GraphQL checkout test
  3. a realistic multi-user journey with cookies/CSRF
  4. a CI/CD-ready k6 test setup

Brands

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.