k6 Studio: GUI สร้าง Load Test สคริปต์ - Record Browser → k6 JS 1 คลิก Open Source
k6 Studio Desktop app (Mac/Win/Linux) บันทึกการคลิกเว็บ → สร้าง k6 script ทดสอบโหลดอัตโนมัติ ไม่ต้องเขียน JS ลดเวลา 90% รองรับ Grafana Cloud/Synthetic Monitoring
k6 Studio vs Manual k6
|
| k6 Studio | GUI Record | Visual | ✅ HAR files |
| Manual k6 | เขียน JS | Console | ❌ |
| JMeter | GUI Heavy | Complex | ✅ |
ใช้งานยังไง (3 นาที)
1. ดาวน์โหลด k6 Studio (Mac/Win/Linux)
2. Record → เปิดเว็บ shopee.co.th
3. คลิก: Login → Search → Add Cart
4. Stop → Generate k6 script
5. Test: 1000 VU → Grafana dashboard
Workflow ใช้งานจริง
Shopee Load Test:
1. Record checkout flow (2นาที)
2. Studio → k6 script + Thresholds
3. k6 run --vus 500 --duration 5m
4. Grafana: P95 < 2s = PASS
ฟีเจอร์เด่น
🎥 HAR Recorder: Chrome DevTools
⚙️ Script Generator: JS + Options
🔍 Validator: Run + Debug GUI
📊 Thresholds: Response time
☁️ Cloud Deploy: Grafana k6
Test Types สร้างได้
|
| Smoke | 10 | 1นาที | Basic OK |
| Load | 100 | 10นาที | Normal traffic |
| Stress | 500 | 30นาที | Breaking point |
| Spike | 1000 | 30วินาที | Flash sale |
Docker + CI/CD
# GitHub Actions
- name: Load Test
uses: grafana/[email protected]
with:
script: tests/checkout.js # จาก k6 Studio
args: --vus 200 --duration 5m
Shopee Thailand Example
Record Flow:
1. shopee.co.th → Search "iPhone 16"
2. Sort price low→high
3. Add to cart → Checkout
4. k6 script: VU=1000, Ramp=10m
5. Metrics: Cart P95=1.2s ✅
Grafana Integration
✅ Real-time dashboard
✅ Alert: P95 > 3s
✅ Historical trends
✅ Cloud or self-host
✅ Synthetic Monitoring
Setup Production
# Mac (Homebrew)
brew install grafana/tap/k6-studio
# Windows: .exe download
# Linux: AppImage
# Test script จาก Studio
k6 run --out cloud=inbucket=shopee-test script.js
Pro Tips
💡 Record mobile view (DevTools)
💡 Exclude 3rd party (CDN/images)
💡 Think time realistic (2-5s)
💡 Thresholds: P95 < 3s, Error < 1%
💡 CI/CD: GitHub Actions + k6 Cloud
Free vs Cloud
|
| Local | Unlimited | Unlimited | Terminal |
| Cloud | 50 free | 60m free | Grafana |
Thai E-commerce Checklist
☑️ Search P95 < 1s
☑️ Add Cart < 800ms
☑️ Checkout < 2s
☑️ Payment 99.9% success
☑️ Mobile 85% conversion