oneiros / docs /10-testing.md
Adinda Panca Mochamad
Day 1: foundation β€” ekstraksi JSON, Gradio minimal, trace logger
c10196a
|
Raw
History Blame Contribute Delete
2.84 kB

A newer version of the Gradio SDK is available: 6.20.0

Upgrade

10 β€” Testing

Piramida tes

        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ agent_test  β”‚  E2E (butuh model, lambat)
        β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
        β”‚ extractor   β”‚  Integrasi LLM
        β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
        β”‚ generator   β”‚  Unit β€” cepat, tanpa model
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Menjalankan

# Dari root repo, venv aktif
python tests/test_generator.py    # jalankan dulu β€” cepat
python tests/test_extractor.py    # butuh GGUF
python tests/agent_test.py        # pipeline penuh

Exit code 0 = semua lulus.


tests/test_generator.py

Tanpa model. Memakai mock JSON.

Kasus

ID Nama Cek
GEN001 Full entity set Semua nama di SVG, SVG valid
GEN002 Minimal kosong Empty map, tidak crash
GEN003 All moods 5 mood generate tanpa error

Validasi SVG

  • Dimulai dengan <svg
  • Diakhiri </svg>
  • Len > 200 byte
  • Nama character/place muncul di string

tests/test_extractor.py

Butuh model loaded.

Kasus

ID Input Harapan
TC001 Narasi standar β‰₯1 character, β‰₯1 place, mood valid
TC002 Mimpi pendek Field wajib, array boleh kosong
TC003 Emosional kompleks characters + places + connections

Field wajib per kasus

Lihat definisi TEST_CASES di file tes.


tests/agent_test.py

3 mimpi E2E:

  1. Library dengan wajah di cover buku
  2. Gigi tanggal di pesta
  3. Pilot pesawat awan hijau

Assert:

  • mood dan title ada
  • SVG valid, len > 300

Fixture: mimpi uji manual

File: tests/fixtures/mimpi_uji.txt

Format: satu mimpi per blok, dipisah ---

Digunakan untuk:

  • Iterasi prompt (target 85%)
  • Regresi sebelum push Space

10 mimpi disarankan

3 dari gr.Examples (forest, underwater office, city of books) + 7 variasi:

  • flying / falling
  • teeth / chase
  • childhood home
  • water / fire symbol
  • minimal abstract
  • anxiety-heavy
  • joyful reunion

Tes manual UX (Day 3)

Pertanyaan Pass?
User tahu harus mengetik mimpi?
User paham tombol submit?
User bereaksi positif pada peta?

Catat 3 bullet di issue atau docs/ux-notes.md.


Tes Space (pre-submit)

  • Build log hijau
  • Status Running
  • Example 1 anxious β†’ map <60s
  • Error input pendek β†’ pesan ramah
  • Disclaimer privasi terlihat

CI (opsional stretch)

GitHub Action hanya test_generator.py β€” tidak download 5GB model.

# .github/workflows/test.yml β€” contoh
- run: python tests/test_generator.py

Dokumen terkait