Why we need write testing? That seem take time and too boring
When developing an API, it’s easy to forget the implementation details over time. While this might not be an issue for individual developers or smaller projects, it becomes a significant challenge as projects scale and teams grow.
Don’t put yourself in a situation where, after a long period, you’re unable to recall the reasoning or functionality behind certain code. This uncertainty can lead to frustration and hinder future development.
Ease of maintenance and the ability to upgrade smoothly are achieved more effectively through comprehensive test coverage than through documentation alone. Robust tests act as a safeguard, allowing you to rest easy knowing your application’s functionality is protected.
Since it’s natural to forget code details over time and to find your own work difficult to revisit, prioritize writing tests immediately after implementing an API. Even better, strive to understand the business requirements thoroughly and write high-quality documentation before creating tests—and, ideally, even before starting the implementation itself. This approach not only clarifies your goals but also streamlines development and ensures long-term success.
Tóm tắt:Là đa số mấy anh em viết API lâu ngày dù có quy tắc code có sạch đến mấy thì anh em cũng sẽ quên chính những đoạn code mình viết ra khi dự án đủ lớn.Rồi giờ sao?Thứ nhất bảo vệ chính mình bằng testing, ít nhất là intergration testing.Hai là bảo vệ đồng đội của mình bằng documentation.Và cuối cùng với bảo vệ khách hàng của mình bằng cách thấu hiểu nghiệp vụ của họ để không phải cái gì được yêu cầu cũng lao vào làm như một con khỉ.