51 lines
1.7 KiB
Markdown
51 lines
1.7 KiB
Markdown
# Week 11: Pengujian White-Box Marketplace UMKM Lokal
|
|
|
|
Tugas Software Testing Week 11, Kelompok D. Berisi potongan sederhana dari logika Order dan Catalog pada proyek [Marketplace UMKM Lokal](https://github.com/MelvynFaith/umkm-marketplace), beserta test PyTest dan analisis coverage.
|
|
|
|
Isi tugas:
|
|
|
|
1. Control flow graph, V(G), dan jalur independen untuk `validate_checkout`
|
|
2. Test PyTest yang menutup semua jalur
|
|
3. State machine dan tabel transisi untuk class `Order`
|
|
4. Test class: transisi valid, transisi tidak valid, dan polimorfisme
|
|
5. Laporan `--cov-branch` beserta analisisnya
|
|
|
|
Penjelasan lengkap ada di [`docs/laporan.md`](docs/laporan.md) (versi Word: `docs/laporan.docx`).
|
|
|
|
## Struktur
|
|
|
|
```text
|
|
umkm/
|
|
checkout.py validate_checkout (modul prosedural, V(G) = 7)
|
|
order.py class Order (state machine, 6 state)
|
|
catalog.py Product, FoodProduct, ClothingProduct (pewarisan dan polimorfisme)
|
|
tests/
|
|
test_checkout_paths.py satu test per jalur independen (P1-P7)
|
|
test_order_state.py seluruh matriks transisi 6 x 6 dan guard pelaku
|
|
test_product_polymorphism.py pewarisan dan polimorfisme Product
|
|
docs/
|
|
laporan.md, laporan.docx laporan
|
|
*.png diagram dan screenshot bukti
|
|
```
|
|
|
|
## Menjalankan
|
|
|
|
Membutuhkan Python 3.10 atau lebih baru (diuji pada Python 3.14).
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
python -m pytest
|
|
```
|
|
|
|
Dengan laporan branch coverage:
|
|
|
|
```bash
|
|
python -m pytest --cov=umkm --cov-branch --cov-report=term-missing --cov-report=html:htmlcov
|
|
```
|
|
|
|
Laporan HTML dibuat di `htmlcov/index.html`.
|
|
|
|
## Hasil
|
|
|
|
67 test lulus. Statement coverage dan branch coverage 100% (28 dari 28 branch). Analisisnya ada di bagian 5 laporan.
|