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

A subcommand to initialize a new test script file #3294

Closed
andrewslotin opened this issue Aug 21, 2023 · 0 comments · Fixed by #3394
Closed

A subcommand to initialize a new test script file #3294

andrewslotin opened this issue Aug 21, 2023 · 0 comments · Fixed by #3394
Labels

Comments

@andrewslotin
Copy link
Contributor

Feature Description

A new k6 script requires writing some boilerplate code. For new users this requires reading the documentation before being able to execute their first k6 run, which creates an additional entry barrier, while for experienced users it's a tedious task that could have been automated.

Suggested Solution (optional)

I propose to add a new init subcommand to k6 that creates a JS file containing a minimal k6 script that can be executed with k6 run. As a content of this file I'd propose the simple local script from the docs:

import http from 'k6/http';
import { sleep } from 'k6';

export default function () {
  http.get('https://test.k6.io');
  sleep(1);
}

I'd also consider adding the code that enables running browser tests, i.e. the options.scenarios section that enables Browser API, and have it commented out similar to what vagrant init does.

Already existing or connected issues / PRs (optional)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants