Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitesh411 committed Mar 25, 2024
0 parents commit ad3cc75
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/basic.yml
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
44 changes: 44 additions & 0 deletions html-report.html

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions script.js
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 }),
}
}

0 comments on commit ad3cc75

Please sign in to comment.