-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ad3cc75
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Basic Workflow | ||
on: [push] | ||
|
||
jobs: | ||
k6_local_test: | ||
name: k6 local test run - basic example | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Run local k6 test | ||
uses: grafana/[email protected] | ||
with: | ||
filename: basic/script.js | ||
flags: --out json=results.json | ||
|
||
- name: Upload performance test results | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: k6-report | ||
path: index.html |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import http from 'k6/http'; | ||
// This will export to HTML as filename "result.html" AND also stdout using the text summary | ||
import { htmlReport } from "https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js"; | ||
import { textSummary } from "https://jslib.k6.io/k6-summary/0.0.1/index.js"; | ||
import { check, sleep } from 'k6'; | ||
|
||
export const options ={ | ||
vus: 50, | ||
duration: '3s' | ||
} | ||
export default function () { | ||
const res =http.get('http://test.k6.io'); | ||
check(res,{'Status was 200': r => r.status == 200}); | ||
sleep(1); | ||
} | ||
|
||
export function handleSummary(data){ | ||
return { | ||
'index.html': htmlReporter(data), | ||
stdout: textSummary(data, { indent: " ", enableColors: true }), | ||
} | ||
} |