ถ้า Business Login มันต้องเชื่อม database ตลอด จะแยก Test ยังไงดีครับ
Assume ว่ามันทำงานถูกครับแล้ว Mock ของแทน
เช่น
class CustomerRepository { public double CalculateNumberOfActiveCustomer() { // complicated logic here } }
ถ้ามันขึ้นอยู่กับ Stored Procedure ในฐานข้อมูล เราก็เทสโดย Mock class นี้มาแล้วก็บอกว่า App เราทำถูกแล้วแต่ฐานข้อมูลมันทำงานผิด อย่างน้อยก็ระบุได้ว่าส่วนไหนเป็นปัญหาครับ
ขอบคุณครับ 😊 เดี๋ยวเอาไปปรับใช้ดูครับ
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
ถ้า Business Login มันต้องเชื่อม database ตลอด จะแยก Test ยังไงดีครับ
Assume ว่ามันทำงานถูกครับแล้ว Mock ของแทน
เช่น
ถ้ามันขึ้นอยู่กับ Stored Procedure ในฐานข้อมูล เราก็เทสโดย Mock class นี้มาแล้วก็บอกว่า App เราทำถูกแล้วแต่ฐานข้อมูลมันทำงานผิด อย่างน้อยก็ระบุได้ว่าส่วนไหนเป็นปัญหาครับ
ขอบคุณครับ 😊
เดี๋ยวเอาไปปรับใช้ดูครับ