xunit test patterns refactoring test code phần 2

Danh sách của Patterns Simpo PDF Merge và Chia Chưa đăng ký - Khẳng định tin nhắn (370): Chúng tôi thêm một đối số chuỗi mô tả trong mỗi cuộc gọi đến một phương pháp Khẳng định. Khẳng định Phương pháp (362): | Simpo PDF Merge and Split UnregisteredVersions-http have no real need for it. The ability to substitute dependencies with Test Doubles page 522 for the purpose of verifying the outcome is also greatly enhanced because substitutable dependency is designed into the software from the start. Tests or Examples Whenever I mention the concept of writing automated tests for software before the software has been written some listeners get strange looks on their faces. They ask How can you possibly write tests for software that doesn t exist In these cases I follow Brian Marrick s lead by reframing the discussion to talk about examples and example-driven development EDD . It seems that examples are much easier for some people to envision writing before code than are tests. The fact that the examples are executable and reveal whether the requirements have been satisfied can be left for a later discussion or a discussion with people who have a bit more imagination. By the time this book is in your hands a family of EDD frameworks is likely to have emerged. The Ruby-based RSpec kicked off the reframing of TDD to EDD and the Java-based JBehave followed shortly thereafter. The basic design of these unit test frameworks is the same as xUnit but the terminology has changed to reflect the Executable Specification see Goals of Test Automation on page 21 mindset. Another popular alternative for specifying components that contain business logic is to use Fit tests. These will invariably be more readable by nontechnical people than something written in a programming language regardless of how business friendly we make the programming language syntax Test-by-Test or Test All-at-Once The test-driven development process encourages us to write a test and then write some code to pass that test. This process isn t a case of all tests being written before any code but rather the writing of tests and code being interleaved in a very fine-grained way. Test a bit code a bit test a