Đang chuẩn bị liên kết để tải về tài liệu:
Phát triển Javascript - part 5

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

Tham khảo tài liệu 'phát triển javascript - part 5', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 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 Download from www.eBookTM.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 rotated. Integration tests test the sum of its parts. Ideally those parts are unit .

crossorigin="anonymous">
Đã 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.