TAILIEUCHUNG - Growing Object-Oriented Software, Guided by Tests- P8

Growing Object-Oriented Software, Guided by Tests- P8: Test-Driven Development (TDD) hiện nay là một kỹ thuật được thành lập để cung cấp các phần mềm tốt hơn nhanh hơn. TDD là dựa trên một ý tưởng đơn giản: các bài kiểm tra Viết cho code của bạn trước khi bạn viết đoạn code riêng của mình. Tuy nhiên, điều này "đơn giản" ý tưởng có kỹ năng và bản án để làm tốt. Bây giờ có một tài liệu hướng dẫn thiết thực để TDD mà sẽ đưa bạn vượt ra ngoài những khái niệm cơ bản. Vẽ trên một. | Chapter 27 Testing Asynchronous Code brittle they would misreport if the system changes the assumptions they ve been built on. One response is to add a test to confirm those expectations in this case perhaps a stress test to confirm event processing order and alert the team if circumstances change. That said there should already be other tests that confirm those assumptions so it may be enough just to associate these tests for example by grouping them in the same test package. Distinguish Synchronizations and Assertions We have one mechanism for synchronizing a test with its system and for making assertions about that system wait for an observable condition and time out if it doesn t happen. The only difference between the two activities is our interpretation of what they mean. As always we want to make our intentions explicit but it s especially important here because there s a risk that someone may look at the test later and remove what looks like a duplicate assertion accidentally introducing a race condition. We often adopt a naming scheme to distinguish between synchronizations and assertions. For example we might have waitUntil and assertEventually methods to express the purpose of different checks that share an underlying implementation. Alternatively we might reserve the term assert for synchronous tests and use a different naming conventions in asynchronous tests as we did in the Auction Sniper example. Externalize Event Sources Some systems trigger their own events internally. The most common example is using a timer to schedule activities. This might include repeated actions that run frequently such as bundling up emails for forwarding or follow-up actions that run days or even weeks in the future such as confirming a delivery date. Hidden timers are very difficult to work with because they make it hard to tell when the system is in a stable state for a test to make its assertions. Waiting for a repeated action to run is too slow to succeed fast to say .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.