Khi nào thì nên và làm thế nào để viết unit vs integration test có ý nghĩa anh nhỉ?
monkeyEnlightened
Khi nào thì nên và làm thế nào để viết unit vs integration test có ý nghĩa anh nhỉ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1a. Trong mọi trường hợp thì đều nên viết unit test, nhưng nếu ngại thì trừ các lớp thực hiện việc cấu hình ra còn lại thì test hết
1b. Chú đang nói đến ngôn ngữ nào? Nếu java thì dùng junit hoặc testng framwork, python cũng có các framework tương tự
1c. Unit test nghĩa là test hàm ở mức nhỏ nhất đến từng if else để đảm bảo logic hoạt động đúng
2a. Đối với những dự án có tích hợp giữa nhiều thành phần với nhau như DB, gọi API, kafka, … thì nên viết integration test
2b. Nếu java thì có thể dùng spring hoặc Cucumber hoặc search google thấy cái nào thích thì dùng
2c. Integration dịch ra tiếng Việt là tích hợp, vậy ý nghĩa của việc test này là kiểm tra việc tích hợp có hoạt động ổn không và trong trường hợp có lỗi thì điều gì sẽ xảy ra.