A load testing harness for Playwright API testing
npm i @playwright/test
npm i @nickvuono/playwright-load-test
Executor | Description |
---|---|
iterations |
runs a specified number of iterations syncronously |
duration |
runs iterations syncrounously for a given duration in seconds |
iterations-per-second |
run a specified number of iterations per second for a given duration in seconds |
variable |
Thes can be specified using the setOptions()
function like so:
run.setOptions({
executor: "iterations-per-second",
duration: 15,
ips: 1,
});
import { test, expect } from "@playwright/test";
import run from "@nickvuono/playwright-load-test";
run.setOptions({
executor: "iterations",
iterations: 10,
});
test("Iterations Executor Test @iterations-executor", async ({ request }) => {
await run.go(async () => {
const response = await request.get("https://yesno.wtf/api");
expect(response.ok()).toBeTruthy();
});
});
import { test, expect } from "@playwright/test";
import run from "@nickvuono/playwright-load-test";
run.setOptions({
executor: "duration",
duration: 10,
});
test("Duration Executor Test @duration-executor", async ({ request }) => {
await run.go(async () => {
const response = await request.get("https://yesno.wtf/api");
expect(response.ok()).toBeTruthy();
});
});
import { test, expect } from "@playwright/test";
import run from "@nickvuono/playwright-load-test";
run.setOptions({
executor: "iterations-per-second",
duration: 15,
ips: 1,
});
test("Iterations per Second Executor Test @iterations-per-second-executor", async ({
request,
}) => {
await run.go(async () => {
const response = await request.get("https://yesno.wtf/api");
expect(response.ok()).toBeTruthy();
});
});
- Fork it (https://github.com/your-github-user/playwright-load-test/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Nick Vuono - creator and maintainer