Memahami bagaimana mengintegrasikan testing ke dalam pipeline CI/CD termasuk QA gates, test environments, dan deployment testing

Setelah di episode 13 kita mempelajari test data management, pada episode ini kita mempelajari testing in CI/CD — bagaimana mengintegrasikan testing ke dalam pipeline continuous integration & deployment. Dalam dunia modern, testing tidak hanya dilakukan manual tapi juga harus terotomasi dan terintegrasi ke dalam CI/CD pipeline.
Mengapa testing di CI/CD penting? Karena dengan CI/CD, code changes bisa di-deploy ke production beberapa kali sehari. Tanpa testing yang terotomasi, kualitas tidak bisa dijamin di setiap deployment.
CI/CD Pipeline:
├── 1. Code Commit
│ └── Developer push code
├── 2. Build
│ └── Compile & build artifacts
├── 3. Unit Tests
│ └── Developer-written tests
├── 4. Integration Tests
│ └── API & service tests
├── 5. QA Gates
│ ├── Coverage threshold
│ ├── Performance threshold
│ └── Security scan
├── 6. Deploy to Staging
│ └── Auto-deploy ke staging
├── 7. E2E Tests
│ └── Playwright/Cypress tests
├── 8. Deploy to Production
│ └── Manual approval
└── 9. Smoke Tests
└── Post-deployment verificationQA Gates:
├── Code Quality:
│ ├── Linting passes
│ ├── Code review approved
│ └── No critical issues
├── Test Coverage:
│ ├── Unit test coverage > 80%
│ ├── Integration test coverage > 70%
│ └── E2E test coverage for critical paths
├── Performance:
│ ├── Response time < 200ms
│ ├── Memory usage < 512MB
│ └── No memory leaks
└── Security:
├── No critical vulnerabilities
├── No high vulnerabilities
└── OWASP scan cleanNote
QA gates harus realistis. Jika threshold terlalu ketat, pipeline akan sering gagal dan developer akan frustrasi. Mulai dengan threshold yang moderate dan naikkan secara bertahap.
name: QA Pipeline
on: [push, pull_request]
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
- run: npm run test:unit
integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
- run: npm run test:integration
e2e-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
- run: npx playwright install
- run: npx playwright testEnvironment Strategy:
├── Local Development:
│ ├── Developer machine
│ ├── Unit tests
│ └── Quick smoke tests
├── CI Environment:
│ ├── GitHub Actions / GitLab CI
│ ├── Automated tests
│ └── Build verification
├── Staging:
│ ├── Production-like
│ ├── E2E tests
│ └── UAT (User Acceptance Testing)
└── Production:
├── Live environment
├── Smoke tests
└── MonitoringCanary Deployment:
├── 1. Deploy ke 5% production traffic
├── 2. Monitor error rates & performance
├── 3. Jika stable, naikkan ke 25%
├── 4. Monitor lagi
├── 5. Jika stable, naikkan ke 100%
└── 6. Jika ada masalah, rollbackBlue-Green Deployment:
├── Blue: Current production
├── Green: New version
├── Deploy ke Green
├── Test di Green
├── Switch traffic ke Green
├── Blue menjadi backup
└── Rollback: switch back ke BlueTip
Untuk QA tester yang baru memulai, fokus dulu pada manual testing di staging environment. Automation & CI/CD integration bisa dipelajari bertahap.
Pada episode 14 ini, kalian telah mempelajari testing in CI/CD.
Inti yang harus dibawa pulang:
Di episode 15 selanjutnya, kita akan membahas performance testing dasar — bagaimana menguji performa aplikasi menggunakan tools seperti k6 dan JMeter. Sampai jumpa di episode 15!