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

Add changes template #64

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

calinepatriota
Copy link

No description provided.

@calinepatriota
Copy link
Author

calinepatriota commented Mar 16, 2024

Hi, I would like to remove the Failed Requests section and allow to colapse to see the checks using group approach

image image

@calinepatriota
Copy link
Author

calinepatriota commented Mar 16, 2024

Example of test it

//
// A generic load test script provided for example purposes and testing
//

import { check, group, sleep } from 'k6'
import http from 'k6/http'

//import { htmlReport } from "https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js";
import { htmlReport } from '../dist/bundle.js'
import { textSummary } from 'https://jslib.k6.io/k6-summary/0.0.1/index.js'

const TARGET_URL = __ENV.TEST_TARGET || 'https://benc.dev'
const RAMP_TIME = __ENV.RAMP_TIME || '1s'
const RUN_TIME = __ENV.RUN_TIME || '2s'
const USER_COUNT = __ENV.USER_COUNT || 20
const SLEEP = __ENV.SLEEP || 0.5

export function handleSummary(data) {
  return {
    'summary.html': htmlReport(data, { debug: false }),
    stdout: textSummary(data, { indent: ' ', enableColors: true }),
  }
}

export let options = {
  stages: [
    { duration: RAMP_TIME, target: USER_COUNT },
    { duration: RUN_TIME, target: USER_COUNT },
  ],
  thresholds: {
    http_req_duration: ['p(95)<1000'],
    iteration_duration: ['max<4000'],
  },
}

export default function () {
  let url = Math.random() > 0.8 ? TARGET_URL : TARGET_URL + '/gibberish'
  let res = http.get(url)

  group('Example group all passed', () => {
    let res = http.get(TARGET_URL)

    check(res, {
      'NOT 500': (r) => r.status !== 500,
    })

    check(res, {
      'OK 200': (r) => r.status == 200,
    })

    sleep(SLEEP)
  })

  group('Example group not all Passed', () => {
    let res = http.get(TARGET_URL)

    check(res, {
      'NOT 500': (r) => r.status !== 500,
    })

    check(res, {
      'OK 200': (r) => r.status == 500,
    })

    sleep(SLEEP)
  })
}

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

Successfully merging this pull request may close these issues.

1 participant