@nickvuono/playwright-load-test
v0.1.1
Published
Load test your apps using Playwright's APIRequestContext
Downloads
2
Readme
🎭 playwright-load-test
A load testing harness for Playwright API testing
Prerequisites
npm i @playwright/test
Installation
npm i @nickvuono/playwright-load-test
Executors
| 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
| ⚠️ In Progress - will allow for ramping up and ramping down iterations per second over given time spans |
Thes can be specified using the setOptions()
function like so:
run.setOptions({
executor: "iterations-per-second",
duration: 15,
ips: 1,
});
Iterations Executor Example
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();
});
});
Duration Executor Example
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();
});
});
Iterations per Second Executor Example
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();
});
});
Contributing
- 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
Contributors
Nick Vuono - creator and maintainer