Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nicholasvuono/playwright-load-test
Load test your apps using Playwright's APIRequestContext 🚀
https://github.com/nicholasvuono/playwright-load-test
api-testing automation load-testing open-source performance playwright typescript
Last synced: 13 days ago
JSON representation
Load test your apps using Playwright's APIRequestContext 🚀
- Host: GitHub
- URL: https://github.com/nicholasvuono/playwright-load-test
- Owner: nicholasvuono
- License: apache-2.0
- Created: 2024-03-14T20:33:33.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-19T05:49:10.000Z (8 months ago)
- Last Synced: 2024-03-19T12:26:54.243Z (8 months ago)
- Topics: api-testing, automation, load-testing, open-source, performance, playwright, typescript
- Language: TypeScript
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🎭 playwright-load-test
[![NPM](https://img.shields.io/badge/NPM-0.1.1-red.svg)](https://www.npmjs.com/package/@nickvuono/playwright-load-test)
![Publish](https://github.com/nicholasvuono/playwright-load-test/actions/workflows/npm.yml/badge.svg)
![CI](https://github.com/nicholasvuono/playwright-load-test/actions/workflows/build.yml/badge.svg)
![CodeQL](https://github.com/nicholasvuono/playwright-load-test/actions/workflows/codeql.yml/badge.svg)
![Prettier](https://github.com/nicholasvuono/playwright-load-test/actions/workflows/prettier.yml/badge.svg)
[![Style: prettier](https://img.shields.io/badge/Style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![License](https://img.shields.io/badge/License-Apache2.0-red.svg)]([http://opensource.org/licenses/MIT](https://github.com/nicholasvuono/playwright-load-test/blob/main/LICENSE))A load testing harness for [Playwright API testing](https://playwright.dev/docs/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:
```typescript
run.setOptions({
executor: "iterations-per-second",
duration: 15,
ips: 1,
});
```
### Iterations Executor Example
```typescript
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
```typescript
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
```typescript
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 ()
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](https://github.com/nicholasvuono) - creator and maintainer