1. Requirements
Install the tools for the language you want to generate.
| Language | Required | Runner |
|---|---|---|
| TypeScript / JavaScript | Node.js 22+ and npm | Playwright Test |
| Python | Python 3.10+ and pip | pytest |
| Java | JDK 17+ and Maven | JUnit 5 or TestNG |
| Performance | k6, Node.js 22+, and Docker Compose for dashboards | k6 with Prometheus and Grafana |
Install k6
brew install k6 # macOS winget install k6 --source winget # Windows
2. Create a project
Recommended
mkdir automation-projects cd automation-projects npx test-framework-scaffolder@latest
Optional global install
npm install --global test-framework-scaffolder@latest test-framework-scaffolder
The project is created under the directory where the command is
launched. Run pwd first if unsure.
π Test Framework Scaffolder
β Project name: k6-tests
β Select language: Performance β k6 + Grafana
β Select framework style: BDD
β Include GitHub Actions? Yes
β Framework files created
Created at:
/Users/me/performance-projects/k6-tests
Open in VS Code:
code "/Users/me/performance-projects/k6-tests"
3. Prompt choices
Project name
Use a lowercase name such as crm-tests. The
destination must not exist.
Language
TypeScript, JavaScript, Python + pytest, Java + Maven, or Performance with k6 + Grafana.
Style
Every language offers BDD Gherkin or TDD/Non-BDD. JavaScript uses playwright-bdd, Python uses pytest-bdd, and Java uses Cucumber. k6 BDD uses a thin Given/When/Then layer and runs natively without a custom k6 binary.
Java runner
Java projects offer JUnit 5 or TestNG for both BDD and TDD/Non-BDD execution.
Testing type
UI creates browser layers, API creates service layers, and UI + API creates both. Choosing k6 automatically creates a focused performance project.
App faΓ§ade
Framework setup stays in fixtures, hooks, and base classes. Tests and steps call page/service methods through app objects.
Allure
For TypeScript/JavaScript, adds Allure result and report commands.
GitHub Actions
Adds CI with environment selection and report artifacts.
Install dependencies
Runs npm, pip, or Maven. Browser installation remains a first-run step.
4. First run
TypeScript / JavaScript
cd "/path/to/project" npm install npx playwright install npm test
Python
cd "/path/to/project" python3 -m pip install -r requirements.txt python3 -m playwright install python3 -m pytest
Java
cd "/path/to/project" mvn test
k6 + Grafana
cd "/path/to/project" docker compose up -d npm run test:grafana
Open in VS Code
code "/absolute/path/to/project"
If code is unavailable, select
VS Code β File β Open Folder.
5. Project structure
project/ βββ config/run.config.json environment and execution settings βββ test-data/ β βββ smoke.json β βββ uat.json βββ utils/CommonMethods.* reusable helpers βββ pages/ UI selection only βββ api/ API selection only βββ features/ and steps/ BDD projects βββ tests/ executable tests βββ reporters/ and scripts/ βββ playwright.config.* TypeScript / JavaScript βββ .github/workflows/ optional CI
Only selected capabilities are generated. API-only projects do not contain UI files.
Generated k6 structure
k6-project/ βββ config/ β βββ run.config.json environment, profile, thresholds β βββ load-profiles.js smoke, load, stress, spike βββ test-data/ β βββ smoke.json β βββ uat.json βββ lib/performance-app.js reusable requests and checks βββ tests/ thin k6 entry point βββ features/ and steps/ BDD projects only βββ observability/ β βββ prometheus.yml β βββ grafana/ provisioning and dashboard βββ scripts/run-k6.mjs environment/profile runner βββ docker-compose.yml βββ .github/workflows/k6.yml optional CI
6. Run configuration
Edit config/run.config.json. Test commands read it
automatically.
{
"environment": "smoke",
"timeout": 30000,
"actionTimeout": 10000,
"navigationTimeout": 30000,
"headless": true,
"retries": 0,
"ciRetries": 2,
"fullyParallel": true,
"workers": null
}
| Property | Meaning |
|---|---|
environment |
Loads test-data/<environment>.json. |
timeout |
Maximum time for one test in milliseconds. |
actionTimeout |
Limit for click, fill, and similar actions. |
navigationTimeout |
Maximum navigation duration. |
headless |
Set false to see the browser during debugging. |
retries / ciRetries |
Local and CI retries. |
fullyParallel |
Runs independent tests concurrently. |
workers |
Null uses automatic workers; otherwise set a positive number. |
k6 run configuration
{
"environment": "smoke",
"profile": "smoke",
"summaryTrendStats": ["avg", "min", "med", "max", "p(90)", "p(95)", "p(99)"],
"thresholds": {
"http_req_failed": ["rate<0.01"],
"http_req_duration": ["p(95)<500", "p(99)<1000"],
"checks": ["rate>0.99"]
}
}
environment selects the matching JSON data file.
profile selects a workload from
config/load-profiles.js. A failed threshold makes the
command and CI job fail.
7. Add any environment
- Copy
test-data/smoke.json. - Rename it, for example
test-data/crm.json. -
Set
"environment": "crm"inrun.config.json. - Run the normal command.
{
"baseUrl": "https://crm.example.com",
"apiBaseUrl": "https://api.crm.example.com",
"apiExpectedStatus": 200,
"validUser": {
"username": "standard_user",
"password": "use-a-secret-variable"
}
}
k6 environment data
{
"baseUrl": "https://test.k6.io",
"endpoint": "/",
"expectedStatus": 200,
"thinkTimeSeconds": 1
}
Add any name such as test-data/crm.json, then set
"environment": "crm". The normal
npm test command discovers it automatically.
8. Run tests
TypeScript and JavaScript
| Goal | Command |
|---|---|
| Entire suite | npm test |
| One BDD feature | npm test login.feature |
| One spec |
npm test login.spec.ts or
npm test login.spec.js
|
| One tag | npm test -- --tag @smoke |
| BDD expression | npm test -- --tag "@smoke and not @slow" |
| UI / API scope |
npm run test:ui / npm run test:api
|
| Environment override |
npm test crm or npm test -- --env=crm
|
| List tests | npm test -- --list |
Python
python3 -m pytest # all python3 -m pytest tests/test_login.py # one file python3 -m pytest -m smoke # marker TEST_ENV=crm python3 -m pytest # environment
Java
mvn test # all mvn -Dtest=LoginTest test # one class mvn test -Dcucumber.filter.tags="@smoke" # BDD tag mvn -Denv=crm test # environment
k6 performance
npm test # run config defaults npm run test:smoke # smoke profile npm run test:load # load profile npm test -- --env uat --profile stress # explicit data + profile npm run test:grafana # publish live metrics
Set environment and profile in
config/run.config.json. Any matching
test-data/<environment>.json is selected
automatically. Grafana is available at
http://localhost:3000 after Docker Compose starts.
[RUN] Framework: bdd | Test type: ui-api
[RUN] Environment: from config/run.config.json
[RUN] Starting Playwright tests...
β Login βΊ Successful login @smoke
1 passed (2.1s)
9. k6 + Prometheus + Grafana
k6 executes JavaScript performance journeys. Prometheus receives the live metrics and Grafana displays the provisioned dashboard.
BDD and Non-BDD
BDD
Includes a readable .feature specification and thin
Given/When/Then functions. The native k6 entry point calls those
steps without requiring a custom k6 binary.
Non-BDD
Includes one thin tests/load-test.js entry point
that calls the reusable performance journey directly.
Available load profiles
| Profile | Generated workload | Command |
|---|---|---|
| Smoke | 1 virtual user, 1 iteration | npm run test:smoke |
| Load | 10 virtual users for 1 minute | npm run test:load |
| Stress | Ramps from 0 to 20, then 50, then back to 0 | npm run test:stress |
| Spike | Rapidly ramps to 100 virtual users and back down | npm run test:spike |
Start and use the dashboard
- Run
npm run dashboard:up. - Run
npm run test:grafana. - Open
http://localhost:3000. -
Sign in with local credentials
admin/admin. - Open Performance β k6 Performance Overview.
- Stop the services with
npm run dashboard:down.
The dashboard shows request rate, p95 duration, failed-request rate,
and active virtual users. The runner uses k6's
experimental-prometheus-rw output and sends metrics to
http://localhost:9090/api/v1/write.
[RUN] k6 bdd | environment=smoke | profile=smoke | grafana=true
β checks rate > 99%
β http_req_failed rate < 1%
β p95 duration < 500ms
10. Reports and diagnostics
reports/errors.logrecords failures.-
test-results/retains failure screenshots, video, and traces where supported. -
Open a trace:
npx playwright show-trace path/to/trace.zip. - HTML report:
npx playwright show-report. -
Allure:
npm run allure, thennpm run allure:open. - k6 thresholds fail the command when service-level goals are not met; Grafana shows live request rate, latency, failures, and VUs.
Traces combine actions, DOM snapshots, console events, and network requests.
11. Add tests
UI
Keep browser behavior in Page Objects. Tests and steps should only call business methods through the app fixture.
API
Keep endpoints and response verification in services so scenarios only call reusable methods.
App faΓ§ade
Page construction, browser contexts, API contexts, tracing, and cleanup belong in the generated app/base layer.
Common methods
Keep shared configuration/data utilities in the generated
CommonMethods.
Performance journeys
Keep requests, checks, and reusable flows in
lib/performance-app.js; keep load models in
config/load-profiles.js.
Tags
BDD uses @smoke. TDD/Non-BDD uses
{ tag: '@smoke' }.
Quality checks
npm run typecheck npm run lint npm test
12. GitHub Actions
The optional workflow installs dependencies, runs the chosen
environment, and uploads reports. Push the project, open
Actions, choose Run workflow, and
enter smoke, uat, or another test-data
filename. Store credentials under
Settings β Secrets and variables β Actions.
A generated k6 workflow uses
grafana/setup-k6-action and provides separate
environment and profile inputs. Choose
smoke, load, stress, or spike from the Actions screen. The CI
command fails when a configured performance threshold is crossed.
13. Publish generator updates
Run publishing commands from the folder that contains this package's
package.json. npm requires a new version for every
release and requires account 2FA or an appropriate publishing token.
cd "/path/to/NPM Scaffolds pacakge" npm whoami npm run typecheck npm run lint npm test npm pack --dry-run npm version patch npm publish --access public
Verify the registry with
npm view test-framework-scaffolder version. The npm
page and its README change only after the new version is
successfully published.
14. Troubleshooting
| Problem | Fix |
|---|---|
| Folder not visible in VS Code |
Run pwd and ls -la <project>,
then code "$(pwd)/<project>" or File β Open
Folder.
|
| Destination exists | Choose a new name or safely move/remove the old target. |
| Browser executable missing |
Run npx playwright install or
python3 -m playwright install.
|
| No tests found |
Check the filename and use npm test -- --list. BDD
also requires matching steps.
|
| Unknown environment |
Create test-data/<name>.json matching the
configured name.
|
| k6 is not installed or not on PATH |
Install k6, restart the terminal, and confirm with
k6 version.
|
| Grafana has no k6 results |
Start Docker with npm run dashboard:up, then use
npm run test:grafana, not plain
npm test.
|
| k6 threshold failed |
Review the failed metric and endpoint behavior before changing
the limits in config/run.config.json.
|
| Docker port 3000 or 9090 is already used |
Stop the conflicting service or change the host-side port in
docker-compose.yml.
|
| Installation is slow | The first run downloads dependencies; browser installation is separate. |
| npm E403 | Enable npm 2FA or use an appropriate granular publishing token. |
15. Quick reference
Create
npx test-framework-scaffolder@latest
Open
code "/absolute/project/path"
Configure
config/run.config.json test-data/<environment>.json
Run
npm test python3 -m pytest mvn test npm run test:grafana
k6 dashboard
npm run dashboard:up npm run test:grafana npm run dashboard:down
Recommended flow: generate β open the printed path β install a browser for UI tests β review configuration β run the sample β replace sample data and coverage.