Questions tagged [k6]

k6 is a backend infrastructure load testing tool written in Go which runs load tests written in JavaScript.

k6 is an open source performance analysis tool for testing backend infrastructure load.

k6 itself is written in Go and runs load test scripts implemented in JavaScript with support for at least ES5.1. Some newer features are also supported through Babel. k6, formerly loadimpact, is owned by Grafana Labs.

k6 supports a variety of common load testing requirements:

  • Scenarios
  • Open and closed workload models
  • (Custom) metrics
  • Thresholds
  • Different protocols, including HTTP, WebSocket, and gRPC
325 questions
4
votes
2 answers

can i write to file in k6 load testing framework?

I am using k6 for our performance test suite.I want to write into file if response code in not equal to 200. Is there anyway to write in file in default method or out side of it?
Sanjay
  • 59
  • 1
  • 8
4
votes
2 answers

Retry http requests in k6

I have a python requests-based suite of API tests that automatically retry every request with a 408 or 5xx response. I'm looking at re-implementing some of them in k6 for load testing. Does k6 have support for retrying http requests?
alpinweis
  • 269
  • 1
  • 8
3
votes
1 answer

K6 - Authentication - Get Auth Token

I have a mocha javascript file in which I have require function to login to the application in headless browser mode, login using the crendentials and return the jwt authentication. I want to call this script through K6. But as I understand, calling…
Jay
  • 339
  • 1
  • 7
  • 23
3
votes
1 answer

k6: k6 --out json - open ./test.json: permission denied

I have created kubernetes cluster on digitalocean. and I have deployed k6 as a job on kubernetes cluster. apiVersion: batch/v1 kind: Job metadata: name: benchmark spec: template: spec: containers: - name: benchmark image:…
3
votes
1 answer

Can't use node fs module with k6

I have followed the instructions here and have setup webpack, but still couldn't use fs module to read the file. Note: I am aware of open() function provided by k6 to read file but i want to check if the file exists before reading, because open()…
user1415083
  • 171
  • 2
  • 7
3
votes
2 answers

Load testing an API which uses oauth token for authorization using loadimpact k6

I'm trying to load test an API (GET method) using loadimpact k6 which requires oauth token for authorization to get the successful response. I already have a postman collection file which does this by running pre-request script. The pre-request…
Nemesis
  • 113
  • 2
  • 10
3
votes
1 answer

Are k6 http calls asynchronous?

Are k6 http calls asynchronous? When I execute a call like http.get(url, params) is k6 waiting until the response? If it is asynchronous and let's say I'm executing few calls and I want the response of a one call as the parameter to another call.…
Sandeepa
  • 3,457
  • 5
  • 25
  • 41
3
votes
1 answer

How to put a customized message in K6 Check

I am running a K6 tests with request.batch where number of requests can change for each test. req = [req0, req1, req2, ...]; let res = http.batch(req); then, I am trying to run a "check" for each request, and I use a while loop to do so. while (i…
Geis
  • 142
  • 10
3
votes
1 answer

Reference error when running k6: regeneratorRuntime is not defined

I had k6 up and running, but now every time I try and run a test I am getting this error: ReferenceError: regeneratorRuntime is not defined. I have tried installing and importing babel, which some people have suggested, but it did not work. import…
Daniel Greene
  • 53
  • 1
  • 5
3
votes
1 answer

How to get group duration value for group

I have a K6 test where load testing a flow and I'm grouping each page request. What I want to do is perform a check on each group's duration so something like group('Home page', function(){ http.get('localhost:8080') }); …
S.Will
  • 380
  • 4
  • 13
3
votes
1 answer

How to use k6 in Node JS

I need to send requests using k6 from node js script I have already tried this: import http from "k6/http"; and this: var http = require('k6/http') but it didn't work out UPD I want to use k6 some like this: node js script: var http =…
John Doe
  • 65
  • 2
  • 6
3
votes
1 answer

K6 how do i make a raw (non encoded) post

I'm trying to use K6 to load test prometheus pushgateway and it wants posts in the following format. http_request_duration_seconds_bucket{le="0.05"} 24054 http_request_duration_seconds_bucket{le="0.1"}…
3
votes
1 answer

JWT signing with k6

How could I encode a JSON object with a JWT signature with k6? export default function() { const mySecret = "aaaaaaa"; const token = jwt.encode({ foo: 'bar' }, mySecret); }
ppcano
  • 2,831
  • 1
  • 24
  • 19
2
votes
1 answer

JWT token authentication with K6

I am new to K6, and I want to authenticate through a JWT token on a login endpoint. I did this first with postman and it works. However, on K6 I am getting a 401 error. Here is my K6 code: import http from 'k6/http'; import { sleep } from…
Ziwdigforbugs
  • 1,185
  • 8
  • 24
  • 41
2
votes
1 answer

K6 trigger ASP.NET Core server function

I have an ASP.NET Core Web API project that is using SignalR, I have a hub there which I am connecting to it using k6 (I want to do some load testings) I manage to connect to my hub but I can not figure out how to call a function from my server, my…
MoTahir
  • 863
  • 7
  • 22
1
2
3
21 22