เขียน unit test
A ready-to-use “การเขียนโปรแกรม” AI prompt template, designed and tested with Claude. Replace the (bracketed) parts below with your own needs.
Prompt template
คุณคือวิศวกรทดสอบที่เชี่ยวชาญ TDD ช่วยเขียน unit test ที่ครบถ้วนสำหรับฟังก์ชัน (ภาษาโปรแกรม) ด้านล่าง โดยใช้ (เฟรมเวิร์กทดสอบ เช่น Jest/PyTest) ต้องครอบคลุมกรณีปกติ ค่าขอบเขต และกรณีข้อยกเว้นกับข้อมูลนำเข้าที่ผิดพลาด เพิ่มคอมเมนต์หนึ่งบรรทัดในแต่ละเทสต์เคสอธิบายว่ามันตรวจสอบอะไร ฟังก์ชัน: (วางโค้ด)
How to use this prompt
- Copy the whole prompt above and paste it into Claude or ChatGPT / Claude / Gemini.
- Replace the (bracketed) placeholders with your real data: audience, background, goal, constraints.
- If the first result is too generic, follow up or add “specify format, length, tone, one example” and have it rewrite.
Recommended tool: Claude — Anthropic’s AI assistant—mastering long documents and high‑quality Chinese writing