Nomor Virtual untuk QA Testing Aplikasi Mobile: Panduan Lengkap
Tantangan Testing OTP di Aplikasi Mobile
Setiap aplikasi mobile yang menggunakan verifikasi OTP pasti menghadapi tantangan saat testing:
- Butuh banyak nomor telepon untuk test registrasi berulang
- SIM card fisik terbatas dan mahal jika beli banyak
- Test otomatis sulit karena harus baca SMS manual
- Nomor bekas sering sudah terdaftar di layanan
Solusi: Nomor Virtual + API
KirimKode menyediakan REST API yang memungkinkan tim QA mengotomatisasi seluruh proses testing OTP.
Setup untuk Tim QA
1. Buat Akun Testing
Buat satu akun KirimKode khusus untuk tim QA. Deposit saldo yang cukup untuk testing (misal Rp 100.000 untuk ~80 nomor virtual).
2. Generate API Key
Di halaman API Docs, generate API Key yang akan digunakan di script testing.
3. Integrasikan ke Test Suite
Contoh integrasi dengan test framework:
// test/helpers/otp-helper.js
const BASE = "https://api.kirimkode.com/v1";
const API_KEY = process.env.KIRIMKODE_API_KEY;
async function getTestNumber(service = "wa") {
const res = await fetch(${BASE}/order, {
method: "POST",
headers: { "X-API-Key": API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({ server: "api1", country: 6, service, operator: "any" }),
});
return res.json();
}
async function waitForOTP(orderId, timeout = 60000) {
const start = Date.now();
while (Date.now() - start < timeout) {
const res = await fetch(${BASE}/order/${orderId}/status, {
headers: { "X-API-Key": API_KEY },
});
const data = await res.json();
if (data.data.code) return data.data.code;
await new Promise(r => setTimeout(r, 3000));
}
throw new Error("OTP timeout");
}
module.exports = { getTestNumber, waitForOTP };
4. Gunakan di Test Case
describe("User Registration", () => {
it("should register with OTP verification", async () => {
// 1. Dapatkan nomor virtual
const { data } = await getTestNumber("wa");
// 2. Register di app dengan nomor tersebut
await app.register({ phone: data.number });
// 3. Tunggu dan verifikasi OTP
const otp = await waitForOTP(data.order_id);
await app.verifyOTP(otp);
// 4. Assert registrasi berhasil
expect(app.isLoggedIn()).toBe(true);
});
});
Best Practices untuk QA Testing
Budget Management
- Track penggunaan lewat endpoint
/orders - Set alert jika saldo di bawah threshold tertentu
- Gunakan negara dengan harga termurah untuk testing
CI/CD Integration
- Simpan API Key di environment variables (jangan hardcode!)
- Buat helper functions yang reusable
- Tambahkan retry logic untuk handle network errors
- Cancel order jika test gagal sebelum OTP masuk (refund saldo)
Test Data Cleanup
- Catat semua nomor yang dipakai di test log
- Cancel order yang tidak terpakai untuk refund otomatis
- Buat cleanup script yang jalan setelah test suite selesai
Keuntungan vs Alternatif Lain
| Metode | Biaya | Automasi | Skalabilitas |
|--------|-------|----------|-----|
| SIM Card Fisik | Mahal | Sulit | Terbatas |
| Bypass OTP (mock) | Gratis | Mudah | Tidak realistis |
| KirimKode API | Terjangkau | Mudah | Unlimited |
Kesimpulan
Nomor virtual dari KirimKode adalah solusi ideal untuk QA testing yang membutuhkan verifikasi OTP nyata. Dengan REST API yang mudah diintegrasikan dan harga mulai dari Rp 1.200 per nomor, tim QA bisa menjalankan test otomatis tanpa hambatan. Mulai sekarang di kirimkode.com.