@nickvuono/playwright-load-test

0.1.1 • Public • Published

🎭 playwright-load-test

NPM Publish CI CodeQL Prettier Style: prettier License

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

  1. Fork it (https://github.com/your-github-user/playwright-load-test/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Nick Vuono - creator and maintainer

Readme

Keywords

none

Package Sidebar

Install

npm i @nickvuono/playwright-load-test

Weekly Downloads

1

Version

0.1.1

License

Apache License 2.0

Unpacked Size

37.1 kB

Total Files

16

Last publish

Collaborators

  • nickvuono