Menguasai teknik test case design seperti equivalence partitioning, boundary value analysis, dan decision table untuk menulis test case yang efektif dan komprehensif

Setelah di episode 2 kita memahami proses & siklus pengujian (SDLC/STLC), pada episode ini kita mempelajari test case design & techniques — bagaimana menulis test case yang efektif dan komprehensif. Test case yang baik adalah kunci testing yang efektif: ia harus clear, reproducible, dan cover semua skenario penting.
Mengapa test case design penting? Karena test case yang buruk akan menghasilkan testing yang tidak efektif — kalian mungkin melewatkan bug penting atau buang waktu untuk test yang tidak signifikan. Dengan teknik yang benar, kalian bisa menulis test case yang cover semua skenario dengan jumlah test yang optimal.
Setiap test case harus memiliki struktur yang jelas:
| Field | Deskripsi | Contoh |
|---|---|---|
| Test Case ID | ID unik | TC-LOGIN-001 |
| Title | Judul singkat | Login dengan valid credentials |
| Preconditions | Kondisi sebelum test | User sudah terdaftar |
| Steps | Langkah-langkah | 1. Buka halaman login |
| Expected Result | Hasil yang diharapkan | User berhasil login |
| Priority | Tingkat prioritas | High/Medium/Low |
Test Case Structure:
├── TC-LOGIN-001: Login dengan valid credentials
│ ├── Precondition: User terdaftar
│ ├── Steps: Buka login → Input email → Input password → Klik login
│ ├── Expected: Redirect ke dashboard
│ └── Priority: High
├── TC-LOGIN-002: Login dengan invalid password
│ ├── Precondition: User terdaftar
│ ├── Steps: Buka login → Input email → Input salah → Klik login
│ ├── Expected: Error message muncul
│ └── Priority: High
└── TC-LOGIN-003: Login dengan empty fields
├── Precondition: -
├── Steps: Buka login → Klik login tanpa input
├── Expected: Validasi error muncul
└── Priority: MediumTeknik ini membagi input ke dalam kelompok (partisi) yang dianggap setara, lalu menguji satu代表 dari setiap kelompok:
Contoh: Input usia (1-120)
├── Partisi 1: < 1 (invalid) → Test: 0
├── Partisi 2: 1-120 (valid) → Test: 25
├── Partisi 3: > 120 (invalid) → Test: 150
└── Total test: 3 (bukan test semua angka)Contoh: Input email
├── Partisi 1: Valid email → Test: user@test.com
├── Partisi 2: Invalid email (no @) → Test: usertest.com
├── Partisi 3: Invalid email (no domain) → Test: user@
└── Partisi 4: Empty → Test: ""Teknik ini fokus pada batas-batas antar partisi, karena bug paling sering muncul di tepi:
Contoh: Input usia (1-120)
├── Boundary: 0, 1, 2, 119, 120, 121
├── Test cases:
│ ├── Age 0 (boundary - invalid)
│ ├── Age 1 (boundary - valid)
│ ├── Age 2 (valid)
│ ├── Age 119 (valid)
│ ├── Age 120 (boundary - valid)
│ └── Age 121 (boundary - invalid)
└── Total test: 6Tip
Boundary Value Analysis lebih efektif daripada test semua nilai dalam range. Bug paling sering muncul di batas-batas: off-by-one error, integer overflow, atau validasi yang salah di tepi range.
Decision table digunakan untuk kombinasi kondisi yang kompleks:
Decision Table: Login Logic
├── Conditions:
│ ├── C1: User exists? (Yes/No)
│ ├── C2: Password correct? (Yes/No)
│ └── C3: Account active? (Yes/No)
├── Rules:
│ ├── Rule 1: Yes + Yes + Yes → Action: Login success
│ ├── Rule 2: Yes + Yes + No → Action: Account disabled
│ ├── Rule 3: Yes + No + Yes → Action: Wrong password
│ ├── Rule 4: Yes + No + No → Action: Wrong password
│ ├── Rule 5: No + * + * → Action: User not found
│ └── (* = don't care)
└── Total test: 5Untuk fitur yang punya beberapa state:
State Diagram: Order Status
├── States:
│ ├── Created → Paid → Shipped → Delivered
│ ├── Created → Cancelled
│ ├── Paid → Refunded
│ └── Shipped → Returned
├── Transitions:
│ ├── Created → Paid: Payment success
│ ├── Paid → Shipped: Shipping processed
│ ├── Shipped → Delivered: Delivery confirmed
│ ├── Created → Cancelled: User cancel
│ ├── Paid → Refunded: Refund processed
│ └── Shipped → Returned: Return processed
└── Test cases: One per transitionBerikut contoh test case lengkap untuk fitur registrasi:
Test Case: TC-REG-001 - Register dengan valid data
precondition: User belum terdaftar
steps:
- Buka halaman registrasi
- Input nama: "John Doe"
- Input email: "john@test.com"
- Input password: "Password123!"
- Konfirmasi password: "Password123!"
- Klik "Register"
expected: User berhasil terdaftar, redirect ke dashboard
priority: High
Test Case: TC-REG-002 - Register dengan email sudah ada
precondition: User john@test.com sudah terdaftar
steps:
- Buka halaman registrasi
- Input email: "john@test.com"
- Input data valid lainnya
- Klik "Register"
expected: Error "Email sudah terdaftar"
priority: HighPada episode 3 ini, kalian telah mempelajari teknik test case design yang efektif.
Inti yang harus dibawa pulang:
Di episode 4 selanjutnya, kita akan membahas test management & documentation — bagaimana mengelola test case, test plan, dan test results menggunakan tools seperti TestRail dan Jira. Sampai jumpa di episode 4!