Code JavaScript to performance test locally and using their k6.io SaaS cloud
Overview
NOTE: Content here are my personal opinions, and not intended to represent any employer (past or present). “PROTIP:” here highlight information I haven’t seen elsewhere on the internet because it is hard-won, little-know but significant facts based on my personal research and experience.
K6 (at k6.io) is the newest tool for performance testing. It uses JavaScript coding.
Install locally
Simplest Script
Call
-
File call-k6-url.js to invoke the k6.io test page:
https://k6.io/docs/testing-guides/running-large-tests/
import http from 'k6/http'; import { check } from 'k6'; import http from 'k6/http'; const res = http.get('https://test.k6.io'); const checkRes = check(res, { 'Homepage body size is 11026 bytes': (r) => r.body.length === 11026, }); export default function() { http.get('http://...'); }
</pre>
Config
https://k6.io/blog/k6-loves-prometheus/
https://k6.io/blog/running-distributed-tests-on-k8s/ Running distributed k6 tests on Kubernetes by Simon Aronsson, Olha Yevtushenko
Commands
-
Run 10 virtual users (vus) for 5 seconds, each performing script.js:
k6 run --vus 10 --duration 5s script.js
References
https://www.youtube.com/watch?v=gvounvDSDGg Basics of load testing with k6 and Grafana in 20 minutes k6
https://www.youtube.com/watch?v=tFsIgbqXbxM Intro to load testing with k6 and Grafana (k6 data source plugin and Prometheus Remote Write) k6
https://www.youtube.com/watch?v=ukoC319npUw&list=RDCMUCWPJwoVXJhv0-ucr3pUs1dA&start_radio=1&rv=ukoC319npUw How to Use k6 to Run Load Testing for a Website (for free)
https://k6.io/blog/k6-loves-prometheus/
https://www.youtube.com/watch?v=5OgQuVAR14I&list=RDLV5OgQuVAR14I&start_radio=1&rv=5OgQuVAR14I The Best Performance And Load Testing Tool? k6 By Grafana Labs DevOps Toolkit
https://www.youtube.com/watch?v=Hu1K2ZGJ_K4 Performance Testing your web app with k6 Chris James
https://www.youtube.com/watch?v=ZAq87eZ1w2U What is K6 & How to get started with k6 Is it Observable
https://www.youtube.com/watch?v=AEk-wgkIo4s Performance Testing with K6 Day 1 On 10th August. Call or whatsapp us on +91-8019952427 to enroll Performance Testing basics and advanced
Product comparisons
https://www.youtube.com/watch?v=KECr2BujqtM 15 Top Load Testing Tools Open Source MUST KNOW in 2021 Automation Testing with Joe Colantonio
https://www.youtube.com/watch?v=noZppBruOSY JMeter vs k6: Comparing two popular open-source load testing tools k6
https://www.youtube.com/watch?v=Be66Db4wHLA Postman for load testing using k6, with Tim Haselaars (k6 Office Hours #43) k6
https://www.youtube.com/watch?v=ZKYK5uyawfM Learn k6 Series - E2 - Recording in k6 using browser extensions QAInsights