Skip to content

Migrate Gatling to k6

QualityMax converts common Gatling HTTP simulations into k6 JavaScript. It recognizes the base URL, named exec(http(...)) requests, HTTP methods, StringBody payloads, and common user-injection settings.

In Performance, choose Convert to k6, select Gatling (Scala), paste the simulation, and choose a load, stress, spike, soak, smoke, or API test profile. Review the conversion report before saving or running the output.

val httpProtocol = http.baseUrl("https://staging.example.com")
val scenario = scenario("Catalog")
.exec(http("List products").get("/api/products"))
.pause(1)
setUp(scenario.inject(rampUsers(20).during(30))).protocols(httpProtocol)
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
stages: [
{ duration: '30s', target: 20 },
{ duration: '3m', target: 20 },
{ 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(1);
}

Run the saved file with k6 run catalog.js only after the target owner approves the traffic profile.

Feeders, conditional branches, throttling, loops, and foreach blocks are reported for manual review. Gatling checks and pauses do not always have one-to-one k6 semantics, so confirm response assertions, pacing, session variables, and request bodies. First compare both tools at one virtual user, then compare the intended steady-state request rate before retiring the Scala simulation.

See performance testing for safe execution and threshold interpretation.