Đang chuẩn bị liên kết để tải về tài liệu:
Test Driven JavaScript Development- P3

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Test Driven JavaScript Development- P3:This book is about programming JavaScript for the real world, using the techniques and workflow suggested by Test-Driven Development. It is about gaining confidence in your code through test coverage, and gaining the ability to fearlessly refactor and organically evolve your code base. It is about writing modular and testable code. It is about writing JavaScript that works in a wide variety of environments and that doesn’t get in your user’s way. | 1.3 Test Functions Cases and Suites 13 1.3.1 Setup and Teardown xUnit frameworks usually provide setup and tearDown methods. These are called before and after each test method respectively and allow for centralized setup of test data also known as test fixtures. Let s add the date object as a test fixture using the setup method. Listing 1.12 shows the augmented testCase function that checks if the test case has setup and tearDown and if so runs them at the appropriate times. Listing 1.12 Implementing setup and tearDown in testCase function testCase name tests assert.count 0 var successful 0 var testCount 0 var hasSetup typeof tests.setUp function var hasTeardown typeof tests.tearDown function for var test in tests if Atest .test test continue testCount try if hasSetup tests.setUp tests test output test 0c0 if hasTeardown tests.tearDown If the tearDown method throws an error it is considered a test failure so we don t count success until all methods have run successfully successful catch e output test failed e.message c00 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. From the Library of WoweBook.Com 14 Automated Testing var color successful testCount 0c0 c00 output strong testCount tests testCount - successful failures strong color Using the new setup method we can add an object property to hold the test fixture as shown in Listing 1.13 Listing 1.13 Using setup in the strftime test case testCase strftime test setup function this.date new Date 2009 9 2 22 14 45 test format specifier Y function assert Y should return full year this.date.strftime Y 2009 . 1.4 Integration Tests Consider a car manufacturer assembly line. Unit testing corresponds to verifying each individual part of the car the steering wheel wheels electric windows and so on. Integration testing corresponds to verifying that the resulting car works as a whole or that smaller groups of units behave as expected e.g. making sure the wheels turn when the steering wheel is .

Đã 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.