Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #123

Open
wants to merge 1 commit into
base: the-one
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,63 @@ This project provides a CLI tool for @idrinth-api-bench/framework to generate co

## Usage & Examples

### Creating a new benchmark project
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the cli, you added the description of the framework. The cli is there to generate routes and folder structures, usually you will not need to clone it at all.


1. Clone the repository:
```bash
git clone https://github.com/idrinth-api-bench/cli
```

2. Navigate to the directory:
```bash
cd cli
```

3. Install the dependencies:
```bash
npm install
```

4. Generate language files:
```bash
npm run language
```

5. Create a new benchmark project:
```bash
npx iabc
```

### Adding routes to new benchmark project

1. Go into the newly created project and create a new file at src/routes/main/first-test.ts. Fill it with the following example content:
```typescript
export default () => ({
id: 'example test case',
main: {
method: 'get',
url: 'https://reqres.in/api/users',
},
pre: [
'^user-agent',
],
post: [
'^status-2xx',
],
});
```

2. Run the benchmark:
```bash
cd benchmark
npm start
```

3. Please don't try to create a service denial scenario and keep the thread count low. Creating a service denial scenario could result in the machine or network resource to become unavailable to intended users. You can use flags to modify the threads and repetitions. The total amount of requests will be threads X repetitions. Eg. 4 threads X 25 repetitions = 100 requests total.
```bash
npx iab bench --threads=4 --repetitions=25
```

Please have a look at the [website](https://idrinth-api-ben.ch) for more
information.

Expand Down