
Grafana k6 Has a Free Load Testing Tool — Write Performance Tests in JavaScript Not XML
Why k6? k6 is a modern load testing tool that uses JavaScript instead of JMeter's XML. Built in Go for performance, runs locally. Quick Start brew install k6 import http from " k6/http " import { check , sleep } from " k6 " export const options = { vus : 50 , duration : " 30s " , } export default function () { const res = http . get ( " https://your-api.com/users " ) check ( res , { " status is 200 " : ( r ) => r . status === 200 , " response time < 500ms " : ( r ) => r . timings . duration < 500 , }) sleep ( 1 ) } Ramping Scenarios export const options = { stages : [ { duration : " 2m " , target : 100 }, { duration : " 5m " , target : 100 }, { duration : " 2m " , target : 200 }, { duration : " 5m " , target : 200 }, { duration : " 2m " , target : 0 }, ], thresholds : { http_req_duration : [ " p(95)<500 " ], http_req_failed : [ " rate<0.01 " ], }, } API Testing with Auth export function setup () { const res = http . post ( " https://api.example.com/auth/login " , JSON . stringify ({ em
Continue reading on Dev.to DevOps
Opens in a new tab



