> Full documentation index: [llms.txt](https://docs.qualitymax.io/llms.txt)

# Migrate Locust to k6

QualityMax can convert common Locust `HttpUser` workloads to k6. The converter recognizes the host, `@task` methods and weights, client HTTP calls, and wait-time intent, then reports anything that needs manual attention.

## Convert a Locust file

Open **Performance**, choose **Convert to k6**, select **Locust (Python)**, paste the Python source, and select the target load profile. Use **Override Target URL** if the converted script must run against staging rather than the source host.

### Before: Locust Python

```python
from locust import HttpUser, between, task


class CatalogUser(HttpUser):
    host = "https://staging.example.com"
    wait_time = between(1, 3)

    @task(3)
    def list_products(self):
        self.client.get("/api/products")
```

### After: runnable k6 JavaScript

```js
import http from 'k6/http';
import { check, sleep } from 'k6';

export const options = {
  stages: [
    { duration: '30s', target: 10 },
    { duration: '3m', target: 10 },
    { duration: '30s', target: 0 },
  ],
};

export default function () {
  const response = http.get('https://staging.example.com/api/products');
  check(response, { 'status is 200': (result) => result.status === 200 });
  sleep(2);
}
```

Save as `catalog.js` and smoke-test with `k6 run catalog.js`.

## Preserve workload meaning

Task weights, random wait ranges, lifecycle hooks, data dependencies, and custom Python helpers can change the effective request mix. Review the generated pacing and explicitly reproduce authentication, test data, assertions, and cleanup. Compare a short Locust run and k6 run at the same concurrency, using both request rate and business outcomes—not only response time—as parity signals.

See [performance testing](/performance/) for the full review checklist.
